Flex 3 profiling not working (update)

The profiler is a part of the Flex Builder IDE, that listens for messages from the profiler agent. The profiler agent is a swf launched in parallel to your main swf. It is located in your Flex workspace at .metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf. Your IDE gets this agent to start by editing your mm.cfg and adding a “PreloadSwf” line. The agent uses the flash.sampler.* API to gather data on your main swf, and sends it to the IDE using TCP on a preconvened port. This port is 9999 by default, you can change it in Preferences/Flex/Profiler/Connections.

If you can not get your profiler working, there are few methods you should try:

  • close all other tabs
  • install debug player
  • change browser
  • change port
  • disable firewall / antivirus
  • define PreloadSwf path
  • localhost / 127.0.0.1
  • allocate console
  • ultimate methods (what worked for me)

Update (Feb 12, 2010): Close all other tabs

Fastest thing to do is to close all other tabs in your browser, close all other instances of browser and than try profile again.

Install debug player

Make sure you have installed debug version of flash player. Well, you probably have… so skip this one.

Change browser

It may seem to be weird but it works. All browsers (chrome, opera, ff) except for internet explorer use same flash player, switching to any other browser may fix your profiling. You can change browser in flex / window / preferences / general / web browser / use external / add …

Change port

Try change default port (flex / window / preferences / flex / profiler / connections / port number) to something else (7777, 8888), there were reports that simple port change helped to solve problem.

Disable firewall / antivirus

Do this on your own, if you are not sure about what you are doing call admin. The aim is to unblock port that is used for profiling. Try disable default windows (os) firewall or make exception. To make exception on your eset smar security use following procedure:

  • Open Smart Security.
  • If you are in standard mode and do not see a menu in the top right hand corner click Setup->Toggle Advanced Mode.
  • Click on the ‘Enter entire advanced setup tree…’ link at the bottom.
  • Click Personal Firewall->Protocol Filtering.
  • Make sure ‘Enable application protocol content filtering’ is selected.
  • Below that select Redirect traffic for filtering->HTTP and POP3 ports.

Define PreloadSwf path

If your IDE does not edit your mm.cfg file properly, change PreloadSwf property in manually. This is undocumented, but adding the property manually is reported as working solution. Try add the following line to the file

PreloadSwf= C:/...flexworkspace/.metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf?host=localhost&port=9999

If you got the the path to the profile agent wrong. You can check this by looking in the flash text logs. If the preload went wrong, you should see a message like:

PreloadSwf paths must be local trusted: C:/...flexworkspace/.metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf?host=localhost&port=9999

Make sure path directs to local trusted area!

localhost / 127.0.0.1

If the profiler in Flash Builder does not work, check if localhost does resolve to 127.0.0.1 on your machine. If not fix the hosts file. – Mario Klingemann (quasimondo)

allocate console

If the Flash Profiler does not start: switch off “Allocate Console” in the Profile Configurations Common tab. – Mario Klingemann (quasimondo)

Ultimate methods (what worked for me)

I spent almost hour trying to figure out why my profiler wont connect in one workspace and works just fine in another even with same settings. I tried every mentioned method but niether worked. While randomly trying all methods I finally came to something new:

Profiling can only be performed on the debug version of an application.

What the hell? Of course I am using debug player and pushing “profile it” button so what is wrong? I tried reinstall player to other versions but did not worked. Well, if you were able to came this far you may wonder what solution I finally figurd out. It is definitely not elegant solution nor correct but works, thats why I called it ultimate 🙂 . Click profile button as fast as you can (5 times in row) and behold! Randomly you get your profile perspective connected and working (if not, try few times)! So definitely a flex bug.

Sources:

8 comments so far

  1. Durairaj January 13, 2010 23:17

    Thanks!! i didnt need to spend much hour like you 🙂 since you wrote a nice blog which was very helpful to figure out. In my case port was causing problems

  2. Pedro January 22, 2010 23:25

    None of above worked for me.. I miss profilling my app

  3. Jozef Chúťka January 23, 2010 00:02

    Pedro, does your application use rsl or external modules? Are you able to profile blank new created project?

  4. How I got it to work March 30, 2010 22:57

    Hi all,

    More than likely the problem has to do with Flash Player security settings. Edit your security settings here:

    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

    Add the root level of your Flash Builder workspace as a ‘trusted’ location. If you were seeing this error in your flash logs:

    PreloadSwf paths must be local trusted:

    you won’t see it anymore and profiling should work!

  5. Jack June 1, 2010 19:58

    Adding the workspace as a trusted location did it for me.

  6. Ivan Slepchenko August 25, 2010 22:05

    removing wmode=”transparent” working for me. This is not a joke!

  7. […] I just unhid the file and it connected. If you’re getting the same error and this workaround does not work for you then take a look at this […]

  8. Brian December 1, 2011 03:14

    I had a custom preloader defined in my application. Disabling it worked for me. Stupid mistake, but took me hours to figure it out.

Leave a comment

Please be polite and on topic. Your e-mail will never be published.