clr

How can I view the disassembly of optimised jitted .NET code?

For one reason or another, I sometimes find it useful or just interesting to look at the optimised compiler output for a function. For unmanaged C/C++ code, my favourite way to do this has been to compile in Release mode, stick a breakpoint in the function of interest, run, and view the disassembly in Visual Studio when it hits the brea...

Clojure on the CLR

I'm interested in investigating Clojure on the CLR. I see that there is a port--but I'm always a bit leery of these second-class citizens (i.e. they don't have the stability or functionality of the original). I'd less inclined to spend much time at this point if generally people find Clojure on the CLR immature--I simply don't have the t...

Does threadpool get shared between application domains?

Consider a process which is creating multiple application domains. Do these Application domains share same thread pool? If yes, how is it coordinated between multiple application domains? ...

Comparison of oleautomation compatible data types and CTS.

When we define a COM interface in MIDL (Microsoft Interface Decription Language), we should utilize the oleautomation compatible data types. These types could be recognized by the COM aware languages. Suddenly, the .NET CTS (Common Type Specification) flashed into my mind. The CTS is the minimum subset of types that any .NET compatible ...

.NET: Way to determine if object has any references to it?

Q. Is there a way to find out if an object has any "strong references" to it? Raymond Chen hinted that a solution might be possible: You want to know whether the reference count is zero or nonzero. For that, use WeakReference. Notes i have a "weak reference" to the object (using a WeakReference). If i had a strong referenc...

Unmanaged C code in C# Marshalling by ref string array!

Hi All, I am having a really hard time getting this marshalling down. I have umanaged code that looks like this: WORD HLP_GetDeviceNames (LPSTR *DevNames, WORD Max_Len, WORD Max_Num) Just FYI I did not write this unmanaged code but must use it. Returns: WORD indicating an error. DevNames: Pointer to an array of char arrays. Basic...

Prevent method from showing up in Stack Traces

Using the .NET CLR, is there a way to prevent a certain method to show up in the stack trace? Especially I just want to remove the last call from the stack trace before throwing an exception. I'm just curious, unsafe calls and reflection hacks are valid solutions. ...

C# rules of function overloading

What are the rules regarding function Overloading? I have the following code: public T genericFunc<T>() where T : Component, new() { T result = new T(); overloadedFunction( result ); } private overloadedFunction ( Component c ) // catch all function private overloadedFunction ( DerivedFromComponent dfc) // specific function ...

Just tried out Obfuscation.

I tried the standard DotNetObfuscator that comes with Visual Studio 2010 on my code. I did not change any standard settings on the code. I am a little puzzled by the behaviour of this tool. I tried to compare the values by loading both assemblies in reflector. Somethings have definitely changed, but I am stil able to read the method as...

CLR SQL Server 2005 procedure to take stored procedure results as a parameter

I have a stored procedure that returns a rowset that I'd like to pass into a CLR stored procedure to do some advanced calculations. How would I set this up? Take the input? Iterate the rowset within the CLR procedure? ...

Performance issues with the ScrollViewer

There seems to be a performance degradation when an items collection control is decorated with a ScrollViewer. In the particular application I am working on, there seems to be a big hit to the application when I decorate a VirtualizingStackPanel with a ScrollViewer. I am trying to load up 250 items in this particular container with the h...

List serialization in CLR aggregation function C#

Hello. I'm trying to add an aggregation function into SQL server 2005 via C#. But when I deploy the project it fails with the following error: .Net SqlClient Data Provider: Msg 6222, Level 16, State 1, Line 1 Type "AggregationTest.CountNonintersectingIntervals" is marked for native serialization, but field "intervals" of type "Aggre...

different code behaviour with and without debugger at C++ .net4

I have WPF application which was migrated from .net3.5 to .net4.0. This application uses an old one C++ library (as I understand this is mixed mode library, means managed-unmanaged). Library moved to .net4 environment with some strange bug which occurs on callback call: if (m_pCANCallback) m_pCANCallback(m_pCANCa...

What do I need to know about the different versions of Java from a .NET perspective?

I'm not sure how to phrase this question, but considering the differences in .NET listed below, is there any comparison to Java and all it's deployments? Platform The same version of .NET can run on either a server or workstatation Since the full version of .NET may be too much for some deployments, there is a client profile only vers...

What does the CLR do on a 'throw'?

As I was working on a project, I thought to myself "Hmmm, it would be really handy to log a message, and then throw an Exception with that same message". Since this would let me keep my "exceptions are for exceptional circumstances" principle, but still make sure we're recording detailed information about what went wrong in the system. ...

Strange casting behaviour. Cannot cast object (int) to long.

There is following code: int intNumber1 = 100; object intNumber2 = 100; bool areNumberOfTheSameType = intNumber1.GetType() == intNumber2.GetType(); // TRUE bool areEqual = intNumber1.Equals(intNumber2); // TRUE long longNumber1 = (long) intNumber1; // OK long longNumber2 = (long) intNumbe...

Application Type

When developing a stand alone application for windows, what type of application should i use. CLR MFC Win32 The application will be connected to an SQL Database, have multible forms, use a Ribbon Bar. If anyone needs more info to answer this question please let me know. ...

Why is it not possible to catch MissingMethodException?

I have a dependency on .NET 2.0 SP2 in my ClickOnce deployed application (the ApplicationDeployment.CurrentDeployment.CheckForDetailedUpdate(false) method is SP2 only). I would like to check whether SP2 is present during app startup. I have tried to detect this by catching MissingMethodException after calling a SP2-only method. ///...

Shouldn't using FieldInfo.SetValue to set a ValueType to null fail?

(related to http://stackoverflow.com/questions/3049477/propertyinfo-setvalue-and-nulls) If I have public class Thing { public int X; }, a Thing o, and a FieldInfo fi that points to the X field, why is it legal to call fi.SetValue(o, null)? The runtime sets the field X to zero, i.e. default(int) instead of complaining that a ValueType ca...

Static member variable not being initialized in Release - Compiler/clr bug?

Expected output & output I get in debug mode, and release mode under VS2010, .NET 4.0: bar construct main Output in release mode not under the VS2010 debugger, and under WinDbg: main Program does not exhibit this behavior on VS2005, .NET 2.0 using System; namespace static_init { public class bar { public bar() ...