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...
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...
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?
...
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 ...
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...
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...
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.
...
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
...
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...
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?
...
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...
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...
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...
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...
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.
...
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...
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.
...
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.
///...
(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...
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()
...