clr

How CLR calls methods correctly hidden by derived class when reference is stored in a base class variable?

拈花ヽ惹草 提交于 2019-12-12 11:58:29
问题 I am trying to understand how CLR dispatches method call correctly when an object hides base class member when object reference is stored in a base class variable. The point of my confusion is the object header created by runtime. The object header on heap has two fields: Type pointer and Sync block index. The type pointer points to the method table of the class. Even if the object reference is of base class, the object created on heap is of derived class. This should cause runtime to use

Firing events in C++ and handling them in C#

拟墨画扇 提交于 2019-12-12 11:29:21
问题 I have an industrial computer with some Digital I/O pins. The manufacturer provides some C++ libraries and examples to handle pin status change. I need to integrate this events onto a C# application. AFAIK the most simple way to perform this is: Make a managed C++/CLI wrapper for the manufacturer libraries that fires events when interruptions are issued from the DIO pins. Reference that wrapper and handle the events in the C# part as it they were normal C# events. I have tried to make this

Memory leak in CLR classes

和自甴很熟 提交于 2019-12-12 11:25:39
问题 I have a memory leak and traced it to this field inside CLR: Microsoft.CSharp.RuntimeBinder.RuntimeBinder.s_instance.m_semanticChecker.globalSymbolContext.GlobalSymbols.tableGlobal.dictionary It can be viewed in debugger using this specification: ((Microsoft.CSharp.RuntimeBinder.Semantics.LangCompiler)(Microsoft.CSharp.RuntimeBinder.RuntimeBinder.s_instance.m_semanticChecker)).globalSymbolContext.GlobalSymbols.tableGlobal.dictionary During execution of application, this dictionary

External “Hello World” Function in SQL Anywhere with Powerbuilder-generated DLL

浪尽此生 提交于 2019-12-12 10:05:11
问题 I created a function in PowerBuilder.NET Hello World . The project compiled as Helloworld.dll , generated in C# from the PowerBuilder utility. Inside Helloworld, I made the non-visual n_cst_helloworld . Inside the non-visual, I made the object function of_hello() . These are the issues I encountered when trying to access Helloworld.n_cst_helloworld.of_hello() in an external function on SQL Anywhere. The external function uses CLR and is called in Interactive SQL right now. Here is the script

Diagnosing CLR errors in Windows Event Viewer

↘锁芯ラ 提交于 2019-12-12 08:53:48
问题 We have an .NET desktop application that crashed in production. How do we diagnose the error? I'd like to know the type of exception that occurred, the error message, and the stack trace. Because the exception wasn't handled by our code, we received the "This application has encountered a problem and needs to close" Windows message box. The only option was to close, there was no debug button. This MSDN article suggested looking in the Windows Event registry. I checked there, and here's the

In C#, why is String a reference type that behaves like a value type?

 ̄綄美尐妖づ 提交于 2019-12-12 06:39:43
问题 A String is a reference type even though it has most of the characteristics of a value type such as being immutable and having == overloaded to compare the text rather than making sure they reference the same object. Why isn't string just a value type then? 回答1: Strings aren't value types since they can be huge, and need to be stored on the heap. Value types are (in all implementations of the CLR as of yet) stored on the stack. Stack allocating strings would break all sorts of things: the

Problem loading C runtime library from executable and DLL

大城市里の小女人 提交于 2019-12-12 06:03:50
问题 I have a WPF application using .Net 3.5, which loads the C runtime library from: c:\windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_508ed732bcbc0e5a\MSVCR90.DLL. Let's call this MyApp.Exe That same folder also includes msvcp90.dll and msvcm90.dll. When I launch a certain dialog, I need to load a certain DLL which is a C++ DLL using CLR (let's call this MyPlugin.dll). MyPlugin.dll is located in the same folder as MyApp.exe, however by using depends.exe I can see that

Compile .NET Micro for x86

扶醉桌前 提交于 2019-12-12 04:46:10
问题 I'm totally at a loss about the build process in the .NET micro source code. How am I suppose to build the source? There are project files that are not compatible with VS and the "BuildLauncher.exe" has no clear directions as to how I should be using it? I want to try and see how hard it would be to compile a runtime for embedding .NET in a native desktop application. 回答1: The OP's comment to JohnD is confusing because it references C++ on a desktop and C# on an 8-Bit CPU. If the OP could

Inconsistent NuGet package and assembly versions

北城以北 提交于 2019-12-12 04:44:57
问题 The NuGet package System.IdentityModel.Tokens.Jwt , version 4.0.2.206221351 , found here contains an assembly System.IdentityModel.Tokens.Jwt.dll that has version 4.0.20622.1351 , different from version of the NuGet package. Why this is not a huge problem? 回答1: NuGet package version numbers are not related to assembly version numbers. They can be different, and must be different from now on, as the package number follow Semantic Versioning. 来源: https://stackoverflow.com/questions/41580529

.NET MSIL: How commands detect size of operands?

試著忘記壹切 提交于 2019-12-12 04:41:42
问题 There is a single add command in MSIL to add two arguments (pop from stack, add, push into stack). How does it know whether it has to pop 2 bytes or 4 or 8 bytes? In java different bytecodes (fadd, dadd, iadd, ...) but how do they handle this in .NET? 回答1: Java bytecode was optimized to be executed by an interpreter, early JVMs did not have Hotspot yet. .NET msil was designed from day one to always be jitted, no special opcodes for different operand types were necessary. The jitter knows the