View Complete Post
Marshaling is an important part of .NET interop. It allows you to call into unmanaged code from managed code. This column will help you get started.
Yi Zhang and Xiaoying Guo
MSDN Magazine January 2008
There are plenty of times when you need to get information on running processes, not the least of which is during performance tuning. Using the techniques in this article and special .NET classes you'll see how to get a process' ID, name, priority, number of threads, kernel handle, and memory consumption, as well as its user-mode, kernel-mode, and total elapsed running time and put them to use in a custom app called AssemblyBrowser.
MSDN Magazine October 2004
Throughout this issue, you'll read all about the promise of Web Services and how the .NET Framework enables Web Service development. Many people will also be building their Web Services atop C++ code and frameworks like ATL Server, particularly when performance is paramount. In this article, the authors show how fully functional Web Services are built using ATL Server and Visual Studio .NET. Beginning with unmanaged C++ classes, they add ATL attributes that make the code work over HTTP.
Kirk Fertitta and Chris Sells
MSDN Magazine December 2002
I am developing a c# application that needs to calls functions from a c header file. I use
[System.Runtime.InteropServices.DllImport("xxx.dll", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true,SetLastError=true)]
public static extern Byte xxxx(IntPtr hResourceContext, ushort xxxx, ref structa aaa,ref Result_struct Result, Byte b);
to import the dll method. When I call this method in C#, the application simply exits without throwing an exception or error. I've used similar approach for other methods from the same dll which involves passing nested structs as parameter and they work
fine. I would like to know how I can debug the code/ catch errors/exceptions from the unmanaged code.
I tried to include the SetLastError=true during DllImport but it does not help.
when we compile our vb.net or c#.net code (say in a simple console application) then in bin\Debug folder a .exe file is created.Is that a managed code? when i directly execute this file,will this target CLR ? or will it directly run on OS ?
Why there is ConsoleApplication1.vshost.exe.manifest files created in that folder ?
What is .pdb file ?
That executable file is also created in obj\Debug folder .Why ?
I have a C# program that at some point calls 2 functions from an unmanaged dll using p/invoke. Everything works fine when I'm running in a console app. When I compile the same program as a windows service and run it, it crashes.
The console app and service should be identical as far as my code is concerned... all either program does is create an object from another assembly of mine and run a Start() method on it.
I have used VS2010 to debug the managed and unmanaged code, and when I step through the Console app everything looks great. When I attach the debugger to the service, i can step through the first function in the unmanaged
code, control returns to the managed code, and then later when it comes to the point where it calls the second unmanaged function, the process terminates immediately before the debugger steps into the first line of unmanaged code. There are no exceptions
that I can see, and the only thing written to the event log is the generic "service terminated unexpectedly" message. Running "sc query" on the command line lets me know the win32_exit_code is 1067.
Im running everything in .net 4, on winxp 32bit. The serivce is running as Local System ideally, but the same behavior exists when I run it under my user account.
is it possible to access an sql ce database from unmanaged code, if i do private deployment? Unfortunatelly we have some scenarios where we must assume that neither .net frameork nor sql ce is installed. Do we have any chance to use sql-ce in
Thanks in advance!