clr

Why does my multithreaded C++ .NET application only crash when executed outside of visual studios?

旧巷老猫 提交于 2019-12-10 10:26:05
问题 I have created a very simple C++ .NET application using both managed and unmanaged code to replicate my problem. When the user clicks a button a new thread should spawn and do some time-consuming tasks while calling back to my main thread with status updates. This code compiles and successfully executes from within side of Visual Studios Express 2010. That is, when I click the "play" button, my project builds and executes without crashing. However, if I go to the Release folder where the

How do I find out what CLR i am using?

大兔子大兔子 提交于 2019-12-10 08:01:15
问题 Is there something available that tells me what .NET version I am using and whether it is .NET 2.0 SP1? Thanks 回答1: You can use Environment.Version to find the version of the CLR you are running on. This can be checked against the list of framework version numbers. For .NET 2.0 SP1 you'd be looking to match 2.0.50727.1433. 来源: https://stackoverflow.com/questions/2161119/how-do-i-find-out-what-clr-i-am-using

CLR 2.0 vs 4.0 performance?

半世苍凉 提交于 2019-12-10 07:54:13
问题 Will a .NET program compiled for CLR 2.0 run faster if running unden CLR 4.0? app.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0.30319" sku=".NETFramework,Version=v4.0,Profile=Client" /> <supportedRuntime version="v2.0.50727"/> </startup> </configuration> 回答1: Typically, no - it will be identical. By default, the CLR 4 runtime will load the CLR 2 runtime to execute your CLR 2 code base. Forcing execution under CLR 4 requires setting

Manual Memory Paging in the .Net Framework (Is it possible / How?)

我怕爱的太早我们不能终老 提交于 2019-12-10 07:22:31
问题 I have a major interest in writing a database management system. Having read a few pages about how SQL Server 2000 was implemented, I discovered that 4KB memory pages were used, each being a direct copy of a 4KB page on the hard disk. These pages were loaded into RAM as needed, and then lazily wrote back to disk when they fell idle (oversimplification). Being in the planning stage of my project, I am wondering if this level of control is possible in code running on the CLR. I realize that C,

Array of pointers in C++/CLI MSIL assembly

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 03:34:28
问题 I'm trying to wrap some legacy C code for use with C# running on .NET Core. I'm using the approach given here to create a C++ wrapper that compiles to pure MSIL. It's working well for simple functions, but I've found that if my code ever uses pointers-to-pointers or arrays of pointers it will crash with a memory violation. Often it crashes Visual Studio and I have to restart everything, which is tedious. For example, the following code will cause the crashes: public ref class example { public

How is JIT compiled code injected in memory and executed?

点点圈 提交于 2019-12-10 02:21:52
问题 "Consider a typical Windows x86 or AMD64 architecture, the memory is divided in executable sections that cannot be written to and data sections that can be written to but cannot be executed (think DEP)." "JIT compiles methods in-memory, does (generally) not store anything to disk, instead moves it around where the next instruction pointer can reach it, changes the current instruction pointer (pointing to the JIT) to point to the newly generated code and then executes it." These two paragraphs

How does the CLR know the type of a boxed object?

风流意气都作罢 提交于 2019-12-10 01:48:11
问题 When a value type is boxed, it is placed inside an untyped reference object. So what causes the invalid cast exception here? long l = 1; object obj = (object)l; double d = (double)obj; 回答1: No, it's not placed in an untyped object. For each value type, there's a boxed reference type in the CLR. So you'd have something like: public class BoxedInt32 // Not the actual name { private readonly int value; public BoxedInt32(int value) { this.value = value; } } That boxed type isn't directly

Why C# does not support the intersection of Protected and Internal accessibility?

一世执手 提交于 2019-12-10 01:21:41
问题 protected internal: The union of protected and internal accessibility (this is less restrictive than protected or internal alone) The CLR has the concept of intersection of protected and internal accessibility, but C# does not support this. So my question is: What's the meaning of omitting this Access Modifier , is there a concrete reason? So why C# should not support it? 回答1: Update: C#7.2 is introducing this with the access modifier private protected , which seems wrong in a few ways but

How to test if numeric conversion will change value?

岁酱吖の 提交于 2019-12-09 19:12:28
问题 I'm performing some data type conversions where I need to represent uint , long , ulong and decimal as IEEE 754 double floating point values. I want to be able to detect if the IEEE 754 data type cannot contain the value before I perform the conversion. A brute force solution would be to wrap a try-catch around a cast to double looking for OverflowException . Reading through certain of the CLR documentation implies that some conversions just silently change the value without any exceptions.

ILDasm, mscorlib and System.Runtime decompilation differences depending on the directory

假装没事ソ 提交于 2019-12-09 18:21:56
问题 I have been playing around with ILDasm and have noticed that: Decompiling C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.dll (36KB) simply returns a manifest file. Decompiling C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.dll (114KB) returns the manifest and all types in the assembly. Decompiling C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\mscorlib.dll (38KB) simply returns a manifest file and