.net - NGen and generic collections. How to get rid of Jitting? -


i'm struggling ngen , generic collections. i've ngen'ed assemblies in solution, still somehow jitting occurred every time app executing code:

private dictionary<int, bool> verifyedfunc;   public securityprovider() {     ...     verifyedfunc = new dictionary<int, bool>();     ...        } 

mda msg:

managed debugging assistant 'jitcompilationstart' has detected problem in '*.exe'. additional information:  <mda:msg xmlns:mda="http://schemas.microsoft.com/clr/2004/10/mda"> <mda:jitcompilationstartmsg break="true"> <method name="mscorlib!system.collections.generic.dictionary`2::.ctor"/> </mda:jitcompilationstartmsg> </mda:msg> 

are there issues ngen , generic collections?

well, isn't problem. made problem using jitcompilationstartmsg debugging assistant. reports jitter got started. went on in previous question mda.

this otherwise entirely normal , way generics work in .net. jitter generates concrete class generic cookie-cutter class definition @ runtime. there 1 instance of concrete class any reference type , 1 each every value type use in code.

this not compatible ngen of course, dictionary<> class in mscorlib.dll , assembly ngen-ed when installed .net on machine. ngen powerless guess front concrete class types going instantiate in code. there countermeasure in mscorlib.dll, pre-defines number of generic types ngen-ed. list<int>, used in application. , in .net framework itself.

you can see these predeclared generic types reference source, commonlyusedgenericinstantiations() method. note how has several precooked versions of dictionary<> in method. not dictionary<int, bool>, unusual. jitter needed create type you.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -