clr

Resolving MSB3247 - Found conflicts between different versions of the same dependent assembly

A .NET 3.5 solution ended up with this warning when compiling with msbuild. Sometimes NDepend might help out but in this case it didn't give any further details. Like Bob I ended up having to resort to opening each assembly in ILDASM until I found the one that was referencing an older version of the dependant assembly. I did try using ...

What are the situations or pros and cons to use of C++/CLI over C#

I have been keeping up with .NET CLR for awhile now, and my language of choice is C#. Up until recently, I was unaware that C++/CLI could produce "mixed mode" executables capable of running native and managed code. Now knowing this, another developer friend of mine were discussing this attribute and trying to determine when and how thi...

Is there a c# precompiler define for the CLR version

Hi, I need to compile code conditionally by the CLR version. e.g there's a code that I need to compile only in CLR 2 (.NET 3.5 VS2008) and not in CLR 4 (.NET 4 VS2010) Is there a precompiler directive for the current CLR version that I can use inside an #if clause? Thanks. ...

String comparison equivalents

I believe these 2 lines are equivalent but after running into a strange issue I no longer believe this to be the case. String mimeType = context.Request.ContentType; (String.Compare("text/xml", mimeType, true) == 0)) is the same as : context.Request.ContentType.ToLower().Equals("text/xml") Are their implementations in the CLR any d...

Is there a possibility of there ever being a PHP.NET?

Sorry if this is a silly and/or stupid question but... Will there ever be, or would it even be possible to have a PHP.NET? Or have I got the wrong end of the stick? It seemed to me that one of the main points of .NET was that you could write your code in one of a bunch of the .NET languages and have it compile into CLR. Could this happe...

Scala on the CLR

The Scala homepage says that Scala 1.4 was runnable on the .NET framework - what is the status of Scala on the CLR now? Is anyone working on it? I think it would make a great GUI tool combined with GTK# and Mono... ...

Code generation for Java JVM / .NET CLR

Hello, I am doing a compilers discipline at college and we must generate code for our invented language to any platform we want to. I think the simplest case is generating code for the Java JVM or .NET CLR. Any suggestion which one to choose, and which APIs out there can help me on this task? I already have all the semantic analysis don...

Module initializers in C#

Module initializers are a feature of the CLR that are not directly available in C# or VB.NET. They are global static methods named .cctor that are guaranteed to run before any other code (type initializers, static constructors) in an assembly are executed. I recently wanted to use this in a project and hacked together my own solution (co...

What/Where is the value of E_CLR_ALREADY_STARTED?

The docs for ICLRRuntimeHost::SetHostControl claim that it can return E_CLR_ALREADY_STARTED. I have been unable to find a definition for this value. Ideally, I'd like to know what the appropriate header to include is (it does not appear to be in corerror.h) but if someone can provide me with the canonical value too I can live with that. ...

How does C# compilation get around needing header files?

I've spent my professional life as a C# developer. As a student I occasionally used C but did not deeply study it's compilation model. Recently I jumped on the bandwagon and have begun studying Objective-C. My first steps have only made me aware of holes in my pre-existing knowledge. From my research, C/C++/ObjC compilation requires all...

How do C/C++/Objective-C compare with C# when it comes to using libraries?

This question is based on a previous question: http://stackoverflow.com/questions/1917935/how-does-c-compilation-get-around-needing-header-files. Confirmation that C# compilation makes use of multiple passes essentially answers my original question. Also, the answers indicated that C# uses type and method signature metadata stored in as...

can a .net 3.5 compiled app run on a machine with only .net 2.0?

Answer seems obvious but thought id ask ... don't have a 2.0 machine handy ...

When does the CLR try to load a referenced assembly?

I want to write a small installer app that installs a web site and creates IIS virtual directories. The app should run on Windows XP/Server 2003 (IIS 6) as well as on Vista/2008 (IIS 7). The problem is: for IIS 6 we create virt dirs by calling WMI/Metabase API, for IIS 7 there is a much better API: Microsoft.Web.Administration, but its ...

Are all of the finalizers invoked during a garbage collection?

Let's say i'm trying to allocate 100 bytes, but since I don't have 100 bytes available in my GC heap, a garbage collection is triggered. Also, in my GC heap there's 100mb worth of unreachable objects. To my understanding, once the GC freed 100bytes, he could decide to stop the collection and continue the program's execution. So let's say...

Error on inserting data in SQL Server db from Excel Sheet

I am inserting data from an Excel sheet to SQL Server 2005 db. I am getting this error randomly, sometimes after 20-30 records and sometimes after 1000s. I am unable to find the reason. I am using Visual Studio 2008. The CLR has been unable to transition from COM context 0x21a7b0 to COM context 0x21a920 for 60 seconds. The t...

Resource messages: 'AssemblyResolver': Not in Cache

I have a small C# library written in C# (and .NET4.0 B2). I use a resource assembly (let's call this XXXAssembly) containing resx files to provide the message strings which are used in other assemblies. When running a program by using these assemblies, I get the following lines (always happen to be 4 these 4 lines): 'AssemblyResolver': ...

Using CLR 4.0 Background GC on a Server

We're building a MMO server, highly optimized for latency. So, with the CLR 4.0 and with introduced new workstation GC, is it now possible to use Background Garbage collection on a Windows Server? ...

How often does a managed thread switch OS threads?

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 (...

Multi-Threading - waiting for all threads to be signalled

I have scenarios where I need a main thread to wait until every one of a set of possible more than 64 threads have completed their work, and for that I wrote the following helper utility, (to avoid the 64 waithandle limit on WaitHandle.WaitAll()) public static void WaitAll(WaitHandle[] handles) { if (handles == null) ...

Is it possible to push simple, parallel calculations to the GPU in .Net?

Hi all With .Net 4.0 coming up, and the new parallel extensions, I wondered if the CLR will be able to optimize and push some calculations to the GPU? Or if any library which can help with the task exists? I'm no GPU programming expert at all, so forgive me if this is a silly question. Maybe the CLR doesn't support interfacing to the G...