clr

sizeof(int) on x64?

When I do sizeof(int) in my C#.NET project I get a return value of 4. I set the project type to x64, so why does it say 4 instead of 8? Is this because I'm running managed code? ...

Solving Erratic Behavior with HttpWebrequest in SQL 2008 CLR UDF

We're currently attempting to implement a sql server 2008 udf to do expansion of shortened urls. We have it working quite well against most of the major url shortening services. However, at seemingly random times it will "hang" and refuse to work against a certain domain (for example bit.ly) while subsequent calls to other services...

How can I know the CLR version of a crash dump?

I have a minidump crashed from a .NET application. Is there any way to know the CLR version (e.g. version of mscorwks.dll) of the fault machine (which generates the crash dump) using either Windbg or some other tool? ...

What profiling tools are available for C#.NET?

Edit: Duplicate of http://stackoverflow.com/questions/3927/what-are-some-good-net-profilers In a previous life as a C++ developer on Linux, I found the built-in profiler gprof to be very handy for finding the best targets for optimization. Is there a similar tool available for C# or the .NET CLR in general? What profiling tool options...

Problems porting Java to J#

I've got a medium sized (25k lines code, 25k lines tests) codebase in java, and would like to port it to run on a CLR as well as the JVM. Only the main class, and a few testing utilities deal with the file system or OS in any way. The rest of the code uses the generic collections APIs extensively, java.util.regex, java.net (but not URL...

Configuration for SQL Server Based Assembly

I have an assembly deployed to SQL Server that performs an export to an accounting system SDK. The reasons that this is deployed to SQL Server are beyond my control, and I cannot modify the target database. In development, I moved several dynamic queries from hard-coding to text files outside the application, so that queries can be twe...

Any alternatives to IronPython, Python for .NET for accessing CLR from python?

Are there any alternatives to Python for .NET or IronPython for accessing .NET CLR? Both of these seem to have downsides in that Python for .NET is not under active development (as far as I can tell) and you lose some features available in CPython if you use IronPython. So are there any alternatives? ...

Implementing C# for the JVM

Is anyone attempting to implement C# for the JVM? As a Java developer, I've been eyeing C# with envy, but am unwilling to give up the portability and maturity of the JVM, not to mention the diverse range of tools for it. I know there are some important differences between the JVM and CLR but is there anything that is a showstopper? ...

C# 'is' operator performance.

I have a program that requires fast performance. Within one of its inner loops, I need to test the type of an object to see whether it inherits from a certain interface. One way to do this would be with the CLR's built-in type-checking functionality. The most elegant method there probably being the 'is' keyword: if (obj is ISpecialTy...

Static Generic Class as Dictionary

A static field in a generic class will have a separate value for each combination of generic parameters. It can therefore be used as a Dictionary<Type, whatever> Is this better or worse than a static Dictionary<Type, whatever>? In other words, which of these implementations more efficient? public static class MethodGen<TParam> { ...

Would a C#/.Net web browser be susceptible to exploits?

Is it correct to say that the .Net platform is more secure because the CLR guards against buffer overflow attacks? Assuming there was a web browser running in a managed OS (like Cosmos, SharpOS or Singularity), would it be technically possible for an attacker to inject IL code into the app? Would I have to worry about attacks that aren...

in c# when returning a string from a function does the memory get freed?

This is what I mean: class mycalss { string myfunc() { string str="hello"; return str; } } ... static void main() { string str2; str2=myfunc(); ... ... } In this case is there a risk that the garbage collector might delete the contents of str2 because str went out of scope? ...

.NET Collections and the Large Object Heap (LOH)

Are .NET collections with large number of items apt to be stored in the LOH? I'm curious about List and Dictionary specifically. In my code, I store a large number (40k+) of relatively small objects (lets say 1k) in temporary Lists and Dictionarys for processing. Does the number of items in these collections increase the likelihood of b...

VS2008: Unit Testing with Code Coverage doesn't work with /CLR

I'm trying to set up unit testing with code coverage in VS2008, for a C++/CLI DLL which is compiled with /clr (not /clr:safe or /clr:pure - it has to be /clr because it uses MFC). The unit tests work perfectly but the coverage information only works if I compile with /clr:safe or /clr:pure. For /clr the Code Coverage Results window show...

CLR Debugger, ASP.NET -- how to increase timeout?

I'm trying to debug a problem (exception being thrown) in an ASP.NET MVC program using the Microsoft CLR Debugger. It works pretty well, except after a minute or two, the debugger gets detached (the web request times out or something?) and I can no longer inspect its state. This is extremely frustrating. How can I make the server/debu...

Please, describe you experience of using Microsoft C++/CLI

C++/CLI is very powerful language. It's the only CLR language where you can seamlessly combine managed and unmanaged code. How many software developers (on this site) are using this language? In what kind of projects do you use it? Is it an adapting of legacy code or creation of an original software? Can you compare old Managed C++ wit...

Library to generate .NET XmlDocument from HTML tag soup

I'm looking for a .NET library that can generate a clean Xml tree, ideally System.Xml.XmlDocument, from invalid HTML code. I.E. it should make the kind of best effort guesses, repairs, and substitutions browsers do when confronted with this situation, and generate a pretend XmlDocument. The library should also be well-maintained. :) I...

What are the implications of using unsafe code

Aside from the fact that the code itself can access memory directly. What are the other implications of using the "/unsafe" compiler flag and the "fixed" keyword? Are there any knock on effects related to code signing and deployment of my .exe (my app is desktop only)? (This isn't about whether or not I should be doing this, the why is ...

CLR SQL Server UDF Question

I am trying to create a CLR UDF that takes in a string value seperated like "Mike|John|Smith". In the UDF I parse out the values and return them in a DataTable. The C# code builds fine and I can create the assembly in SQL pointing to the DLL without a problem. Problem comes in when I am trying, according to this source, to tell SQL Ser...

Diagnosing CLR errors in Windows Event Viewer

We have an .NET desktop application that crashed in production. How do we diagnose the error? I'd like to know the type of exception that occurred, the error message, and the stack trace. Because the exception wasn't handled by our code, we received the "This application has encountered a problem and needs to close" Windows message box....