clr

Why would Visual Studio/CLR produce a "bad" executable?

This is a weird problem I have started having recently. My team is developing a COTS application and we have a few people with their hands in the code. A few weeks ago, I received an error message when trying to debug (and run the compiled EXE): "Windows cannot access the specified device, path, or file. You may not have the appr...

Checking if a file is a .NET assembly

I've seen some methods of checking if a PEFile is a .NET assembly by examining the binary structure. Is that the fastest method to test multiple files? I assume that trying to load each file (e.g. via Assembly.ReflectionOnlyLoad) file might be pretty slow since it'll be loading file type information. Note: I'm looking for a way to chec...

Can I run a .NET garbage collection from WinDbg?

I'm looking into why a managed process is using a lot of memory. Is there a way to run GC.Collect(3) from WinDbg, so that I can focus on the actual memory allocation? ...

What's a reasonable amount of memory for a .NET application?

I've had a couple of complaints that one of our managed apps is using 20-25Mb of RAM. I normally push back and say that memory's cheap; get over it. Is this reasonable for a Windows Forms app? ...

Fatal Execution Engine Error (79FFEE24) (80131506)

I'm encountering problems with my .NET Framework 3.0 SP1 application. It is a C# winforms application communicating with a COM exe. Randomly either the winforms app or the COM exe crashes without any error message and the event log contains this entry: [1958] .NET Runtime Type: ERROR Computer: CWP-OSL029-01 Time: 11/25...

Hosting CLR - Bad parameters

Hello, I'm trying to host the CLR inside my C++ application and I'm having problems invoking the entry point of the managed application. The entry point is defined as usual: static void Main(string[] args) And here's the actual C++ code: CComPtr<_MethodInfo> entryPoint; hr = assembly->get_EntryPoint(&entryPoint); // this works just ...

Using .NET Framework 3.5 in a SQL Server 2005 Stored Procedure

I have an SQL Server 2005 server, and I'd like to run a .Net CLR stored procedure on it. However, I'd like to use .NET Framework 3.5. If I try this right now, I get this error: Error: Assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' was not found in the SQL catalog. I'm told this is possible ...

C# 4 and CLR Compatibility

Are all the additions to C# for version 4 (dynamic, code contracts etc) expected to run on the current .NET CLR, or is there a planned .NET upgrade as well? ...

Create empty C# event handlers automatically

It is not possible to fire an event in C# that has no handlers attached to it. So before each call it is necessary to check if the event is null. if ( MyEvent != null ) { MyEvent( param1, param2 ); } I would like to keep my code as clean as possible and get rid of those null checks. I don't think it will affect performance very much...

How to get .NET version (1.1, 2.0, 3.0 etc.) under which an Assembly was built?

I have an assembly. Is there a way to detect which version of .NET was used to build that assembly? ...

Tell me again why we need both .NET and Windows? Why can't Windows morph into the CLR?

The same way DOS morphed into Windows? We seem to have ended up supporting and developing for three platforms from Microsoft, and I'm not sure where the boundaries are supposed to lie. Why can't the benefits of the CLR (such as type safety, memory protection, etc.) be built into Windows itself? Or into the browser? Why an entirely oth...

For any new Win32 application development, are you foregoing .NET?

Are you choosing not to use managed code for any new applications for Win32? Why? Are there resources you need that aren't available from the CLR? (Note "New" - not enhancements to existing codebases.) ...

Is it possible to write a script to easily deploy clr stored procedures?

I would like to include CLR stored procedure deployment in our deployment script (powershell at the moment), however I can't figure out a nice way to do this automatically. I would have thought there would be a nice command line option to do the same as right-click deploy in Visual studio ...

How to return an nvarchar(max) in a CLR UDF?

Assuming following definition: /// <summary> /// Replaces each occurrence of sPattern in sInput with sReplace. This is done with the /// CLR: new RegEx(sPattern, RegexOptions.Multiline).Replace(sInput, sReplace). The result of the replacement is /// the return value. /// </summary> [SqlFunction(IsDeterministic = true)] public static S...

Getting Line Numbers for Errors Thrown in SQL Server CLR Runtime

Hi all, I've created a CLR stored procedure that I'm running on SQL 2k5 and I'm wondering if there's any way to get line numbers for exceptions thrown by the .NET code. When an Exception is thrown, I get something along the lines of Msg 6522, Level 16, State 1, Procedure myProcedure, Line 0 A .NET Framework error occurred during exec...

C#/CLR Remote debugger: how to wait until attached

Today I ran into a problem were I needed to remote-debug a program. The program was launched from another system, so I really don't have an opportunity to interact with it on the command line. I could change its source easily though. What I needed to happen was for the program to start normally, and then wait for me to attach to it wi...

Does Sql Query Notification work for clr stored procedures?

Trying to set up caching on our datasets - we're using clr stored procedures - The database doesn't seem to notify the application of data changes ...

string conversion in Python

I'm using Python 2.5. The DLL I imported is created using the CLR. The DLL function is returning a string. I'm trying to apply "partition" attribute to it. I'm not able to do it. Even the partition is not working. I think "all strings returned from CLR are returned as Unicode". Help me please. It's very urgent. Thank you Jetxee for your...

CLR stored procedure calling .NET class instance

Hi, I codded a CLR stored procedure (listed below) The line of code where the exception is thrown was added just for the purpose of having the exception logged in EventLog I deployed the assembly and created the stored proc in database However when I execute the stored procedure no entry is logged in Windows' EventLog If the code wh...

Mono on the iPhone?

Has Mono been ported to the iPhone yet? I'd love to write .NET apps for the iPhone, and learning Objective C isn't an option for me. ...