clr

Error <mutex> is not supported when compiling with /clr or /clr:pure

让人想犯罪 __ 提交于 2019-12-07 07:25:39
问题 I have a C++ dll which I will call Dll A where I have used: #include <mutex> Dll As properties are set to "No Common Language Runtime Support" and it builds successfully. I have another Dll B which includes DLL A in its references. Dll Bs properties are set to: "Common Language Runtime Support (/clr)" as it includes C++/CLI code. When I build DLL B I get the error: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\mutex(8): fatal error C1189: #error : <mutex> is not supported

Derived method stronger than override in c#?

房东的猫 提交于 2019-12-07 07:07:22
问题 ( again annoying question... ) after asking this before - ( which is partly related to my question) - i got an answer : See §7.6.5.1 of the C# 4 spec: The set of candidate methods is reduced to contain only methods from the most derived types: For each method C.F in the set, where C is the type in which the method F is declared, all methods declared in a base type of C are removed from the set. ok. i have this code : // .Dump() is like a WriteLine command... public class Base { public void

What is the exactly Runtime Host?

隐身守侯 提交于 2019-12-07 06:12:28
问题 What is the exactly definition of Runtime Host? From MSDN: The common language runtime has been designed to support a variety of different types of applications, from Web server applications to applications with a traditional rich Windows user interface. Each type of application requires a runtime host to start it. The runtime host loads the runtime into a process, creates the application domains within the process, and loads user code into the application domains. So is it a process which

Catching First Chance Exceptions in Managed Code without being debugged [duplicate]

强颜欢笑 提交于 2019-12-07 05:02:42
问题 This question already has answers here : Is there a way to log or intercept First Chance Exceptions (3 answers) Closed 2 years ago . Is there a way to catch First-Chance exceptions, and log them without running under a debugger? I suppose another way to ask the question is can I write something that will act like a debugger being attached to my process and see what is going wrong while it happens? 回答1: If you are on .NET 4.0, you can use theAppDomain.FirstChanceExceptionevent to get

Are value types boxed when passed as generic parameters with an interface constraint?

若如初见. 提交于 2019-12-07 04:59:15
问题 (As a result of doing the research to answer this question, I (think I have!) determined that the answer is "no." However, I had to look in several different places to figure this out, so I think there is still value to the question. But I won't be devastated if the community votes to close.) For example: void f<T>(T val) where T : IComparable { val.CompareTo(null); } void g() { f(4); } Is 4 boxed? I know that explicitly casting a value type to an interface that it implements triggers boxing:

How often does a managed thread switch OS threads?

六眼飞鱼酱① 提交于 2019-12-07 04:14:08
问题 I understand that managed threads are not guaranteed to run on the same OS thread. If the CLR may switch a managed thread between OS threads, how often does this happen? What influence the frequency? I've got a separate question on how to stop the switching from happening. Second prize for me would be for this to not happen too often (less than once a minute would be fine). 回答1: It completely depends on the host. There is no guarantee as to when or where a thread switch might take place (if

Performance impact of changing to generic interfaces

流过昼夜 提交于 2019-12-07 03:21:05
问题 I work on applications developed in C#/.NET with Visual Studio. Very often ReSharper, in the prototypes of my methods, advises me to replace the type of my input parameters with more generic ones. For instance, List<> with IEnumerable<> if I only use the list with a foreach in the body of my method. I can understand why it looks smarter to write that but I'm quite concerned with the performance. I fear that the performance of my apps will decrease if I listen to ReSharper... Can someone

.NET CLR InternalCall

你离开我真会死。 提交于 2019-12-07 03:19:31
问题 Is there a way to host the .NET CLR runtime and register MethodImplOptions.InternalCall functions? (This is not a topic about P/Invoke) 回答1: SSCLI code (specifically clr\src\vm\ecall.cpp) suggests that there is no way to register InternalCall methods, because the crucial gECClasses table is hardcoded. 回答2: IMetaDataImport is your best bet, but can't really vouch for that. This seems like a specific task for C++/CLI. 来源: https://stackoverflow.com/questions/1317861/net-clr-internalcall

Is there one managed heap per CLR or per process?

↘锁芯ラ 提交于 2019-12-07 00:28:19
问题 As far as I know, before .NET 4.0 things were simple: one process could only host one CLR . But from version 4.0 a process can host more than one CLR. In this case, I guess there is one heap per CLR , because each CLR has its own state and its own GC with its own way of managing memory and its own collection cycles, so sharing memory just seems impossible. 1) Could you confirm that this is conclusively the case or is it more subtle? 2) Are two CLR's hosted in the same process strictly

Checking if a file is a .NET assembly

别说谁变了你拦得住时间么 提交于 2019-12-06 19:05:07
问题 I've seen some methods of checking if a PEFile is a .NET assembly by examining the binary structure. Is that the fastest method to test multiple files? I assume that trying to load each file (e.g. via Assembly.ReflectionOnlyLoad) file might be pretty slow since it'll be loading file type information. Note: I'm looking for a way to check files programmatically. 回答1: Maybe this helps from https://web.archive.org/web/20110930194955/http://www.grimes.demon.co.uk/dotnet/vistaAndDotnet.htm Next, I