managed

Managed to unmanaged code call causes access violation... sometimes

This code causes the following exception, sometimes: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt" private static TOKEN_GROUPS GetTokenGroups(IntPtr tokenHandle) { var groups = new TOKEN_GROUPS(); uint tokenInfoLength = 0; uint returnLength; var res = Ge...

Reducing the size of minidumps of managed programs while keeping some heap information?

With the dump debugging support in .NET 4.0 we are looking into automatically (after asking the user of course :) creating minidumps of C# program crashes to upload them to our issue tracking system (so that the minidumps can assist in resolving the cause of the crash). Everything is working fine when using the WithFullMemory minidump t...

What is the Difference in Managed and Unmanaged Code, Memory and Size?

After seeing and listening lot about Managed and Unmanaged Code , and knowing about the only difference is that Managed is about CLR and un-managed is out side of CLR, it makes me really curious to know in detail , what is it that all about Managed and Un-Managed Code,Memory and Size? How can a code I write in C# can be unmanaged while ...

VS2010 remote debugging with default transport problem

Hi, I need to do remote debugging of managed code (.NET) on a server hosted on a different network. Neither the client or server is on a domain so i have to use the public ip of the server. I'm trying to use Visual Studio -> Attach to process -> default transport with the qualifier [email protected] but it's not working. I get the error...

Get ItemId of next email given ItemId of current email, using Exchange Web Services (EWS) Managed API

I need to write a method in C# that uses the Exchange Web Services (EWS) Managed API to read emails from a mailbox and given the ItemId/UniqueId of the current email, returns the ItemId/UniqueId of the next email in the inbox after the current email. Furthermore, for various reasons I require the method to be a static stateless method, ...

Is a WPF application managed code only?

I want to use WPF in an app. I want to write it in C++. Does the application have to be managed? I know that I can mix managed with unmanaged. I'm wondering if I can have the whole application be unmanaged. ...

Interop question about StringBuilder.

I am calling a C# method from C code. The C# method: [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void p_func(StringBuilder arg); public static void callback(StringBuilder arg) { Console.WriteLine(arg.ToString()); } The C method: extern "C" void c_method(p_func f) { char msg[4]; ...

Pointer to managed array in C++/CLI

Alright, I know how you normally would declare a pointer: void SomeFunction(array<float> ^managedArray) { pin_ptr<float> managedArrayPtr = &managedArray[0]; } This works fine except when managedArray contains no elements. In that case, it throws an IndexOutOfRangeException. In C# you can do this: void SomeFunction(float[] managedA...

what is the difference between "managed" vs "unmanaged"?

I hear/read about it sometimes when talking about .NET, for example "managed code" and "unmanaged code" but I have no idea what they are and what are their differences. What are their difference, by definition? What are the consequences of using either of them? Does this distinction exist in .NET/Windows only? ...

Debugging both, native (ANSI C DLL) and managed (C# Assembly) code.

Hello, I'm having some troubles debugging a solution which contains both a native ANSI C DLL project and a managed C#/WPF application project. I call the functions exported by the DLL using the LoadLibrary/GetProcAddress Win32 API functions (DllImport attribute is not applicable for my program as the DLL is selected by the user). Both ...

Convert array<int^>^ to int*

how can I convert array<int^>^ to int*? ...

Object pointer in C#?

I'm a C++ user and i started a few ago with C#, to be able to use XNA, because it makes really easy working with 2d textures and 3d models, so that i can forget a bit about that and just center in the game code. The problem comes that I'm used to the pointers, so that my way of thinking the code usually makes use of some, and I couldn't...

What is mean by managed and unmanaged resource in dot net?

What is mean by managed and unmanaged resource in dot net? how they comes in picture ? ...

passing an unmanaged function pointer callback to managed code using C++ interop

Hi all, I'm trying to add some managed code into an existing c++ GUI application. I'd like to get a functional callback working...specifically, I'd like to pass a method pointer from UNMANAGED code to MANAGED code and have the managed code invoke the callback. I'm looking at something like this: typedef int (__stdcall *ANSWERCB)(int)...

Global dictionary vs. GCHandle

Hey, I am required to pass some sort of identifier to unmanaged code which then processes a request and calls back into my managed code once it has done some processing. I was wondering whether it would be better to create a GCHandle and pass it to the unmanaged code to then recover the object once the unmanaged code passes the GCHandl...

COM vs tightly wrapped managed c++ objects

So, there is a legacy code that has to be imported into .NET projects. Which one do you preffer, and why: packing it into COM module or making small and tight c++ managed wrapper around it There is third option of exporting the functions in the DLL, but let's say that we want classes here. ...

Modifying method return value for managed code in Visual Studio 2010 debugger

Say I have this C# method: public bool GetVal() { return a1 == b1 || c1 == d1 || GetE1() == GetF1(); // Illustrating complicated logic here.. } I don't want to modify the content of the variables / return values of methods in the statement above, but want to return false to the method that's calling GetVal(). Is it possible to us...

What happened to ManagedSpy ?

ManagedSpy is supposed to be the .NET equivalent of Spy++, but somehow the download page is now not availeble any more. Anyone who knows why? Anyone that knows a replacement? --jeroen ...

What are the different ways of combining C++ and C#?

Possible Duplicate: Writing a DLL in C/C++ for .Net interoperability I am writing a school project in C++, where I would like to have a GUI written in C# with WPF. This leads me to my question: What are the different ways of combining unmanaged C++ and C# and what are the advantages of each? Preferably I would like to have ...

Calling COM wrapped c# dll from unmanaged c++: how to pass a 'string' and retrieve an updated value

I use COM interop to call functions in a c# dll from my VC6 MFC DLL, and this works fine. I want to call a function to retrieve string values. How do I declare a 'string' in my unmanaged C++? How should the 'string' appear in the c# code? Currently the c# function in the dll takes ref string arguments, and my c# test app works fine, but ...