Questions tagged [managed]

Managed refers to code that requires and will only execute under the control of a Common Language Runtime (CLR). Any code written in C# or Visual Basic .NET is managed code.

890 questions
4
votes
1 answer

How do I use ConditionalAttribute in C++-CLI?

I have a C++-CLI ref class that exposes a profiling infrastructure implemented in C++. In C++ I have the preprocessor directive PROFILING_ENABLED to determine whether the intrusive profiling functions are in the code or not. When exposing these to…
Elad Maimoni
  • 3,703
  • 3
  • 20
  • 37
4
votes
1 answer

Marshaling byval C-structure as return value in C#

I have unmanaged code: ... typedef struct foo { int a; bool b int c; } FOO,*LPFOO; .... __declspec(dllexport) FOO __stdcall GetFoo() { FOO f; return f; } .... I've declare C# prototype for GetFoo…
Anton Semenov
  • 6,227
  • 5
  • 41
  • 69
4
votes
0 answers

Does a managed pointer to a value-type field keep its containing GC instance alive?

[author's edit:] Indeed this appears similar to a post from 3 months ago. Both remain valuable, however, since they show different examples, and this question, in particular, generated an important discussion containing valuable expert information…
Glenn Slayden
  • 17,543
  • 3
  • 114
  • 108
4
votes
2 answers

Understanding of Managed C++

I am having a trouble understanding how does managed C++ work and compile. In .NET Framework, you can develop code in C#/VB/F#/..etc. and all of these languages will be compiled to the same Common Intermediate Language (CIL) which is similar to Java…
Everyone
  • 1,751
  • 13
  • 36
4
votes
0 answers

Overwrite machine.config oracle.manageddataaccess.client version setting at app.config C#

Edit: To be more clear, My question is how to overwrite machine.config setting from app.config for without modify machine.config. I have to do that is because Visual studio EntityFramework Wizard/Server Explorer…
LeY
  • 659
  • 7
  • 21
4
votes
2 answers

Custom attributes are not consistent?

i have converted a C++ library to managed and get the following error on this code line: std::ifstream fin(filename, std::ifstream::in); Errors: Error 30 error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent:…
Tareq Ibrahim
  • 365
  • 5
  • 18
4
votes
1 answer

How to get integer value from IntPtr-parameter in managed delegate that is called from native function with void *?

I have native function void SetValue(char *FieldName, void *pValue); and I want to change it to call earlier set callback/delegate that has signature void SetValueDelegate(string fieldName, IntPtr value); I call native SetValue like this: int…
char m
  • 7,840
  • 14
  • 68
  • 117
4
votes
0 answers

How to link/reference unmanaged dependencies of a managed DLL?

My solution (in Visual Studio 2010) contains the following projects: CppLibrary : a native C++ library (generates a .lib) CliLibrary : a managed C++/CLI library that wraps the native C++ library (generates a .dll) CsharpGUI : a C# GUI project that…
J.Hess
  • 41
  • 2
4
votes
1 answer

How can I mark as read all emails fetched through EWS in a single update?

I followed the EWS Managed API example on MSDN to find all unread email in my Exchange mailbox account. I later went through each found item in order to place them in the list I need to return while fetching the body of each message and updating…
Armfoot
  • 4,663
  • 5
  • 45
  • 60
4
votes
1 answer

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…
Adam Driscoll
  • 9,395
  • 9
  • 61
  • 104
4
votes
1 answer

using System::Drawing namespace in managed C++ class library

I am moving a few functions from a Managed C++ Winforms app to a class library so that I can call them in a new C# app I'm writing. However one of the functions returns a System::Drawing::Bitmap^ and uses the System::Drawing::Color class which is…
Tony
  • 43
  • 1
  • 3
4
votes
3 answers

MEF + Plug-In not updating

I asked this on the MEF Codeplex forum already, but I haven't gotten a response yet, so I figured I'd try StackOverflow. Here's the original post if anyone's interested (this is just a copy from it): MEF Codeplex "Let me first say that I'm…
user64718
  • 827
  • 3
  • 9
  • 22
4
votes
2 answers

c++ Managed to unmanaged conversions

I have done a number of Managed wrappers that deal with wrapping unmanged code for use in managed, but not so many that go the other way. An experiment I was running involved using managed code to find directories and return them in a std vector. …
user3228938
  • 155
  • 1
  • 8
4
votes
3 answers

Blittable Vs. Non-Blittable in IL

I'm trying to make sure that my Managed to Unmanaged calls are optimized. Is there a quick way to see by looking at the IL if any non-blittable types have accidentally gotten into my pinvoke calls? I tried just writing two unmanaged functions in a…
Michael Covelli
  • 2,113
  • 4
  • 27
  • 41