clr

What happens when a .net application is started?

↘锁芯ラ 提交于 2019-11-27 05:19:26
问题 I have been developing apps using .net for quite sometime now. But, I am still not sure how does the CLR know that a .net app has started. Is there like one instance of CLR per app? I don't think this can be the case as there is just one GC which manages all the memory for all .net apps. Does the CLR kind of run in background? I am quite confused. 回答1: Hmm, let me take a shot at this too. Somebody builds a .NET application in C#, or .NET 'Intermediate Language', or another managed language.

No AppDomains in .NET Core! Why?

大城市里の小女人 提交于 2019-11-27 05:15:59
问题 Is there a strong reason why Microsoft chose not to support AppDomains in .NET Core? AppDomains are particularly useful when building long running server apps, where we may want to update the assemblies loaded by the server is a graceful manner, without shutting down the server. Without AppDomains, how are we going to replace our assemblies in a long running server process? AppDomains also provide us a way to isolate different parts of server code. Like, a custom websocket server can have

CLR vs JIT

倾然丶 夕夏残阳落幕 提交于 2019-11-27 04:59:14
问题 What is the difference between the JIT compiler and CLR? If you compile your code to il and CLR runs that code then what is the JIT doing? How has JIT compilation changed with the addition of generics to the CLR? 回答1: The JIT is one aspect of the CLR. Specifically it is the part responsible for changing CIL/MSIL (hereafter called IL) produced by the original language's compiler (csc.exe for Microsoft c# for example) into machine code native to the current processor (and architecture that it

Usages of object resurrection

喜夏-厌秋 提交于 2019-11-27 04:37:07
问题 I have a problem with memory leaks in my .NET Windows service application. So I've started to read articles about memory management in .NET. And i have found an interesting practice in one of Jeffrey Richter articles. This practice name is "object resurrection". It looks like situating code that initializes global or static variable to "this": protected override void Finalize() { Application.ObjHolder = this; GC.ReRegisterForFinalize(this); } I understand that this is a bad practice, however

Possible to merge a DLL into a .NET EXE? [duplicate]

喜欢而已 提交于 2019-11-27 04:29:13
问题 This question already has an answer here: Embedding DLLs in a compiled executable 15 answers I have a DLL that stores classes common to two applications. I'd like to keep my application limited to one EXE file and would like to see if I can somehow embed this DLL within my main EXE. How can I embed the external DLL into my application? (if possible) 回答1: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=22914587-b4ad-4eae-87cf-b14ae6a939b0&displaylang=en ILMerge is a utility for

CLR and CLI - What is the difference?

我与影子孤独终老i 提交于 2019-11-27 04:18:27
问题 I want to know what exactly is the difference between CLR & CLI? From whatever I have read so far, it seems to indicate that CLI is a subset of CLR. But isn't everything in the CLR mandatory? What exactly may be left out of CLR to create a CLI? 回答1: The CLR is Microsoft's implementation of the CLI standard. 回答2: CLR is the execution environment in which a .NET application is safely hosted/run. You can see it as .NET's private Operating System that initiates and loads just before a .NET

Where is the .NET JIT-compiled code cached?

谁说胖子不能爱 提交于 2019-11-27 04:12:24
问题 A .NET program is first compiled into MSIL code. When it is executed, the JIT compiler will compile it into native machine code. I am wondering: Where is these JIT-compiled machine code stored? Is it only stored in address space of the process? But since the second startup of the program is much faster than the first time, I think this native code must have been stored on disk somewhere even after the execution has finished. But where? 回答1: Memory. It can be cached, that's the job of ngen.exe

Why value-types are stored onto Stacks?

流过昼夜 提交于 2019-11-27 03:52:20
Why does C# (.Net) prefer stack to store value types? What is the primary reason behind this design? Is it because read/write operations to the stack take better advantage of the machine processor? Also, maybe you can justify why not others? Eric Lippert discusses this here ; firstly, it is incorrect that "value types are stored on the stack". They sometimes are, but not as: fields on a class captured variables variables in an iterator block When they can be stored on the stack it is a convenient way of modelling their lifetime, but it isn't required to store them on the stack. You could write

Load different version of assembly into separate AppDomain

只愿长相守 提交于 2019-11-27 03:40:12
问题 I'm implementing application that supports plugins. Currently the problem arises when I try to load common assembly that is used both by host application and plugin: host application should use one version of that assembly, while plugin uses another version. This is dictated by application upgrade process - plugin can be updated separately from host application. Every assembly is signed, so I use strong names for loading assemblies. I created a test application which demonstrates the problem.

MVVM binding to CLR Events

微笑、不失礼 提交于 2019-11-27 03:38:06
问题 How do you go about binding to a CLR event using the mvvm pattern? For routed events I am using the EventToCommandTrigger from Cinch's framework and that is working great. I checked out the Behaviors and Effects from the Expression Blend Samples and it looks like the DataEventTrigger is what I should use, but the sample is a little confusing. I want the IsVisibleChanged event to fire my IsVisibleChangedCommand. I am also not sure what code needs to go in the ViewModel to support this. <i