clr

C# .NET passing a collection of InterfaceImplementingClass objects to a routine that takes a collection of Interface objects

I have a routine public void SomeRoutine(List<IFormattable> list) { ... } I then try to call this routine List<Guid>list = new List<Guid>(); list.Add(Guid.NewGuid()); SomeRoutine(list); And it fails with a compile-time error. System.Guid implements IFormattable, but the error I get is cannot convert from 'System.Collections....

How does CLR know to make copy of parameters(precisely objects) ?

When we call any method that's outside the machine boundaries ( remote methods ) , how does the CLR know this and then serialize ( or make copies of ) actual objects and not the memory addresses ( references to the actual objects ) to send when any method is called crossing the machine boundaries ? This question came to my mind realizin...

CLR Assembly for Encryption/Decryption

We recently implemented some symmetric keys in MS SQL 2005 for encrypting and decrypting credit card, check routing/account numbers. Ideally, we would like a user defined function to be able to perform the encryption and decryption, however, its not possible since the encryptbykey and decryptbykey functions cannot be used within user de...

Static methods vs instance methods in C#

For an application I am writing, I want to have extreme extensibility and extension methods seem to give me what I want, plus the ability to call them without an instance, which I need too. I remember reading that static methods are faster than instance methods but don't get the advantages of GC. Is this correct? It's highly unlikely I...

Missing Native Images

I've just run NGen on an .exe assembly, to install, and it says all is up to date, but there is no Native Assembly folder in the GAC, nor is there any Native Assembly service. What's up? ...

BOO Vs IronPython

What is the difference between IronPython and BOO? Is there a need for 2 Python-like languages? ...

CLR vs JIT

What is the difference between the JIT compiler and CLR? If you compile your code to il and CLR runs that code then what is the JIT doing? How has JIT compilation changed with the addition of generics to the CLR? ...

Access TimeZoneInfo from SQL 2005 Server

The .NET TimeZoneInfo class is great and I thought it would answer all my issues with recording data from multiple time zones in my SQL 2005 database. To convert a UTC datetime in the database to any other time zone i'd just get the time zone into a TimeZoneInfo class using TimeZoneInfo.FindSystemTimeZoneById() and then call the TimeZon...

in .NET when you pass a class instance/interface as a parameter do you pass one object or the full vtable

If you are passing an interface or an instance of a class as a parameter, are we passing many objects or the full vtable, because once you call a method on the instance it need to recurse the vtable and call the appropriate one right? How does this work? ...

MSIL: "Operation could destabilize the runtime" exception

Hi! I've been playing with PostSharp a bit and I ran into a nasty problem. Following IL in Silverlight assembly: .method public hidebysig specialname newslot virtual final instance void set_AccountProfileModifiedAt(valuetype [mscorlib]System.DateTime 'value') cil managed { .maxstack 2 .locals ( [0] bool ~propertyHasCh...

User-Defined Aggregate in SQL Server 2008 - How to deploy with MaxByteSize = -1?

I read here (and elsewhere) that it's possible, in SQL Server 2008, to build a user-defined aggregate which can return a string longer than 8000 characters. This is exactly what I need. Supposedly, the method is to set maxByteSize to -1 instead of a number btw 1 and 8000; this should allow any size up to 2GB. For some reason, apparent...

Do you anticipate the CLR to adapt NUMA soon?

Seems like NUMA is promising for parallel programming, and if I am not wrong the current latest cpus have built-in support for it, like the i7. Do you anticipate the CLR to adapt NUMA soon? EDIT: By this I mean having support for it, and taking advantage of it. ...

Multiple versions of .NET CLR running concurrently

Let's say I have a .NET user application (.exe) running under Windows that was compiled in .NET Framework Version 3.0 (VS2008). If that application loads another .NET Assembly (.dll) that was compiled on a different computer using .NET Framework Version 2.0 (VS2005), will the loaded assembly use the existing 3.0 runtime (which will run ...

My 32 bit headache is now a 64bit migraine?!? (or 64bit .NET CLR Runtime issues)

What unusual, unexpected consequences have occurred in terms of performance, memory, etc when switching from running your .NET applications under the 64 bit JIT vs. the 32 bit JIT? I'm interested in the good, but more interested in the surprisingly bad issues people have run into. I am in the process of writing a new .NET application w...

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

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

Is the foreach in VB.NET faster than in c#?

My co-worker said that in a previous interview, he learned that foreach is faster in VB.Net than c#'s foreach. He was told that this was because both have different CLR implementation. Coming from a C++ perspective, I'm curious on why this is and I was told that I need to read up on CLR first. Googling foreach and CLR doesn't help me un...

Is there a way to grant privileged access to a .NET assembly to only one other assembly?

I have a class library assembly and some test code. Because the test code needs to peek at the internals of the the class, it needs to be part of the assembly and because I don't want to have it run all by it's self, it needs have something public so that a different assembly can invoke it. This ends up tacking on some code that shouldn'...

How do I access the .NET TimeZoneInfo class from SQL Server 2005?

The TimeZoneInfo class has a Host Protection Attribute of MayLeakOnAbort. This seems to prevent me accessing it from the SQL Server CLR. But is there a workaround? ...

Does C# inline properties?

Does C# inline access to properties? I'm aware of the 32 byte(instruction?) limit on the JIT for inlining, but will it inline properties or just pure method calls? ...

Interpreting JavaScript outside of the browser?

This is more out of curiosity that a real requirement, but I'm wondering if it's possible to treat JavaScript as (ideally) a first-class .NET citizen, or (secondarily) have some way of invoking/interpreting pure JavaScript functions (that don't require the DOM) in a desktop setting? Has anyone ever attempted implementing a CLR version o...