Silverlight Execution Context Within Browser
I need some information on XAP files execution context in the browser. Specifically, how and where the XAP file is loaded when it is loaded into memory.
My understanding is that it would be loaded in the address space of the web browser's process, this wou开发者_如何学编程ld be done once per instance of the browser window.
Reason for this question is I need to understand how static variables (defined in a type located in XAP package) behave and their lifetime,- for example when XAP package is running in multiple browser windows (ie. user opened 3 IE windows but is viewing the same page). This also raises important issue whether static data in static variables can be shared across browsers, which I don't is the case.
What I did notice through my testing is that when I F5 (page refresh) all the static types were re-created (ie. my singletons were re-created, I could see this by seeing all static member fields losing their previous value they had back to default value when class is initialized)
Any links to more reading would be also appreciated.
Thx,
lk
Every instance of Silverlight is sandboxed to that specific instance. Even multiples of the same Silverlight app in the same Browser page are duplicate instances and nothing is shared.
If you refresh the browser you have flushed your program from memory and are starting again.
They are therefore not even shared between browser tabs.
Not much to read about really, just a fact of Silverlight life :)
精彩评论