clr

Why is creating an appdomain so expensive?

What are the exact reasons that the creation of an appdomain is so expensive. They share the same heap, the same assemblies etc. What exactly needs to be done by the CLR that comsumes so much resources? We have seen scenarios where accessing a type/instance from the other appdomain takes up 10 seconds (update: all required assemblies th...

Questions about .NET Application Domains.

Hi, I know that once a .NET application is launched, 3 Application Domains are created automatically by the CLR, they are System Domain, Shared Domain and Default Domain. System Domain: Create the Shared & Default domains Provide the funcitons of loading and unloading application domains Load mscorlib.dll into Shared domain Bookkeepi...

Questions about IntPtr

Hi, When I make some P/Invoke or COM InterOP, I often bump into the IntPtr. So here is a couple of questions: Everyone said that IntPtr is a struct, so what's in it? I can only think of an 32bit/64bit integer which is the address it points to. Anything else? Where is the IntPtr located? If it is a struct, I believe it should be in the...

Javascript engine with good interoperability with JVM and CLR

Due to the huge resources behind it, Javascript seems to rapidly becoming the scripting language of choice for applications, particularly those with a web front end. I have an application that requires extensibility both on the front and backend. Javascript, or a thin wrapper like CoffeeScript, seems like an excellent, future-oriented, ...

Is the CLR incompatible with Java (as a language)?

I have wondered for a while about the feasibility of having Java run on the CLR. After seeing a previous question here, I realize that there are quite a few differences between the Sun Java platform and the .NET runtime that would make cross-compiling impossible in all but the most trivial cases. That being said, isn't IL a Turing-comp...

Visual C++/CLI (CLR) Null pointer

I wan't to implement the following code - the check if the pointer is null or not null. If the pointer points to object, then do sth with that object, if not - skip that code block. My code: ref class EchoClient { private: GameMatrix^ gameMatrix; public: EchoClient(void); EchoClient(GameMatrix^); void do(); }; EchoClie...

How to force an application to use .NET 3.5 or above?

Our application is built with VS 2008, uses Linq and has Target Framework set to .NET Framework3.5. It works OK when only .NET 3.5 or 4 is installed on the machine. However, on machines where both .NET 2 (or 3.0) and .NET 4 are installed, the application is loaded with .NET 2, and crashes when Linq is accessed, as it looks for the .NET...

Code Access Security is a joke?

I have just read about this article about Code Access Security. It has such an example in it: using System.Security.Permissions; public class MyFileAccessor { public MyFileAccessor(String path, bool readOnly) { path = MakeFullPath(path); // helper fcn FileIOPermissionAccess desiredAccess = readOnly ? FileIOPermissionA...

Is it possible to change the value of a string property within a .NET AppDomain from another seperate .NET AppDomian.

Hi, Is it possible to change the value of a public property (type string) of a class within a given .NET AppDomain from another separate .NET AppDomain assuming both AppDomain's are running in the same process. The other important assumption is that the code running in the AppDomain that contains the property can not be modified .. ie ...

How to preload .net assemblies

At my work, we are developing different applications using .net framework 4. All the applications use common assemblies that we developed, for example the data layer in data.dll. These applications reside on a network drive and are launched directly from there. Most big applications take a while, like maybe 4-5 seconds, to launch the fi...

Using /clr and noclr libraries in one project

Hi, I am encountering some issues with one project. I need to use two libraries but one needs to be compiled with the /clr switch as the other cannot be compiled with this switch. Would there be a way to use at the same time those two libraries in one project? Currently it's compiled with /clr and I got linking errors with the noclr li...

Calling a function from a Win32 .lib project with /clr from a project that is a pure Win32 project, no clr

Hi All, I want to know how do I exactly call a function from ProjectA::ClassA::FuncA() that is a Win32 .lib with /clr from a ProjectB::ClassB::FuncB() that does not have clr support and is a pure Win32 project. Both these projects are under same solution. First, this is what I have tried: 1. Created the ProjectA with the .lib 2. Added t...

How would one use a CLR 4.0 component in a CLR 1.1 or 2.0 App?

While I have seen some discussions on the utilization of an older CLR 2.0 component within a newer CLR 4.0 application, how would one handle the opposite case? For example, if one had a legacy app in .Net 2.0, and wanted to take advantage of a newer business logic that took full advantage of the 4.0 version of the CLR, how would one go ...

How to create threads in ASP.NET pages from CLR thread pool instead of ASP.NET pool ?

If I create a new thread on an ASP.NET page the IsThreadPoolThread property is true. First question is, is it from ASP.NET pool or CLR pool ? Second question is, if it is from ASP.NET pool then how to create a thread from CLR and don't use ASP.NET pool ? I need a synchronous solution for long-running requests (full story). ...

How do you extend a C# interface in C++/CLR?

I'm really frustrated with this one. I'm trying to extend a C# created interface in C++/CLR. The interface has one method and I've declared it in my class, but the compiler keeps telling me that I must still provide an implementation for the interface method. What more can I do? What am I missing!? Does anyone have any examples of h...

SQL CLR stored Procedure to query active directory

I need to obtain some information from the users in the database that is stored on Active Directory, I've a simple function to do this: using (DirectoryEntry de = new DirectoryEntry("LDAP://ANYGIVENDOMAIN")) { using (DirectorySearcher adSearch = new DirectorySearcher(de)) { adSearch.Filter = "(sAMAccountName=jdoe)"; ...

How to add reference to a dynamic assembly for compiling another dynamic assembly?

In my AppDomain there are few dynamic assembly, when I try codeDom.CompileAssemblyFromSource to Compile another new assembly, I can't figure out a way to add those dynamic assemble to ReferencedAssemblies. foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { compilerParameters.ReferencedAssemblies.Add(assembly.L...

Deciphering the .NET clr20r3 exception parameters P1..P10

i'm trying to decipher the meaning on the P1...P10 parameters associated with a clr20r3 that is written to the event log when my application experiences an exception. The best i've been able to find is: P1: the hosting process (e.g. w3wp.exe) P2: the hosting process version (e.g. 6.0.3790.1830) P3: ??? (e.g. 42435be1) P4: the assembly...

[CLR Threading]When a thread pool thread blocks, the thread pool creates additional threads

I see this in the book "CLR via C#" and I don't catch it. If there are still threads available in the thread pool, why does it create additional threads? ...