none
Writing Silverlight Profiler for other browsers RRS feed

  • Question

  • Naily Hedi asked a question on my blog, which I'm moving to this forum:

    "I'm working on a silverlight profiler. Actually, I'm setting environment variables globally so that the profiller DLL is loaded by all silverlight applications. The profiler works with Internet Explorer but doesn't with Chrome and Mozilla Firefox. In fact, Internet explorer creates a new process for each silverlight applications however, with Chrome or Firefox only one process is created whatever the nember of applications is, and that's the reason why I can't write output to different files (one for each application) with Chrome and Firefox. Do you have an idea on how to deal with this issue."

    Monday, April 8, 2013 4:05 PM

All replies

  • Hi, Naily.

    I'm unfamiliar with the internals of Chrome and Firefox.  In theory, the only dependency that CLR profiler loading has, is on environment variables.  So long as the environment variables get set inside whatever worker processes are used by Chrome or Firefox, then in theory the CLR should try to load your profiler.

    I would use windbg to break into whatever worker processes are used by those browsers, and use "!peb" to view the environment variables actually set.  Is it possible that the browser doesn't let its worker processes inherit env vars?  Or maybe the env vars are set, but there was an error (security?) loading the profiler.

    Has anyone else from this forum gotten this work?

    Thanks,
    Dave

    • Proposed as answer by HediNaili Wednesday, September 11, 2013 10:54 AM
    • Unproposed as answer by HediNaili Tuesday, January 7, 2014 9:16 AM
    Monday, April 8, 2013 4:07 PM
  • On rereading, I wonder if I misinterpreted your question.  Perhaps you're saying that your profiler DOES load ok, but since there's only one process, you don't know how to distinguish between pages?

    If so, perhaps you could try generating a unique ID in your Initialize() callback, and use that unique ID for that callback instance (for each time it needs to write info into a log).  Again, I've never tried this in non-IE browsers, but hopefully, you'll see a unique instantiation of your callback object per Silverlight control (with its own call to Initialize(), and thus its own unique ID that I'd advise you to generate), even if there's only one process.

    Thanks,
    Dave

    • Proposed as answer by HediNaili Monday, September 16, 2013 10:13 AM
    • Unproposed as answer by HediNaili Tuesday, January 7, 2014 9:16 AM
    Monday, April 8, 2013 4:15 PM
  • Hi Dave
    Thanks for your answer, and yes my profiler loads ok and this is exactly what I meant. Unfortunately, there is only one call to Initialize() and I couldn't find a way to distinguish between pages. The problem is that I want to profile all silverlight apps even if they are running simultaneously otherwise a simple restart of the web browser would solve the issue. 
    Thanks again Dave,

    Hedi



    • Edited by HediNaili Tuesday, April 9, 2013 11:03 AM
    Tuesday, April 9, 2013 10:58 AM
  • Interesting.  How many calls are there to your profiler DLL's DllGetClassObject?
    Tuesday, April 9, 2013 3:44 PM
  • Only one call too
    • Edited by HediNaili Tuesday, April 9, 2013 5:47 PM
    Tuesday, April 9, 2013 5:45 PM
  • Then I'm stumped.  Just to double-check what environment variables are you setting (and their values)?
    Tuesday, April 9, 2013 6:03 PM
  • here are my environment variables : 

    CoreCLR_Enable_Profiling = 1

    CORECLR_PROFILER = {MyProfilerGuid}

    Tuesday, April 9, 2013 6:24 PM
  • Yep, those look correct.  I don't suppose those browsers have a setting to run each page in a separate worker process?  All I can think is maybe there's some way to configure the browsers so that profiling will work, and you can tell your users how to do this.  Sorry, at this point I'm out of ideas.

    Thanks,
    Dave

    Tuesday, April 9, 2013 6:35 PM
  • I agree with you, there must be a way to force the browsers to run each page in a separate process. Don't be sorry :) thank you very much Dave and have a great day.
    Tuesday, April 9, 2013 6:57 PM
  • Hi Dave, 

    I just asked a question in the forum but it seems like profiling doesn't interest much people. I thought you could help me. Here is the question : How to get object name from its id?

    Thanks.

    Friday, April 12, 2013 2:14 PM
  • Monday, April 15, 2013 6:17 PM