Hello all,
I have just come back to C# after a long absence.
I was working on a class library that I wrote whose purpose is to call unmanaged code I have written in C. It uses P/invoke.
I'm using Visual Studio Express for Desktop 2013.
Initially I had a single solution with two projects:
- one for the class library and
- one for a demo program that calls on this library.
In the demo project I added
a reference to the class library, and that is also where I put the unmanaged DLL's I was calling. This seems to work fine.
But then management said, "We cant give them the sources of our class library, so why dont you create two solutions:
one that creates the DLL, and one for the demo (a console application), and we shall ship the Demo solution along with the DLL's (managed and unmanaged)."
So now, in the Demo solution I created a subdirectory named Dependencies and copied the DLL's into that, and I tried adding a reference to thsi occurence of the managed DLL. In the demo solution 's Object Explorer I can indeed see the names of these class methods. The problem is that the application crashes as soon at it reaches a call to the library methods (static methods, by the way). The crash is not accompanied by any message at all.
All was working fine in one solution, why is it crashing this way? Am I misunderstanding what a reference is?
Henri de FeraudyPosted Nov 12, 2014, 10:24 AM
Everything works fine if I use Visual Studio Express 2010.
Looks like a bug in VS 2013.
Henri de FeraudyPosted Nov 12, 2014, 9:35 AM
I thought I would tell you about "progess" on this.
I originally created a solution with Visual Studio Express 2010 with a console app test project and a DLL project. The test project references the DLL project and it works, whether I compile it with the latest compiler or not.
However I created a new solution with Visual 2013 and I copied the files from the original solution into this one. This involves changing the namespace that was provided by the compiler. I aimed at exactly the same structure of two projects: a class library and a console app that refers to the library.
The new solution crashes when I try to run it with Control-F5. So it looks like it has nothing to do with my sources but something to do with the configuration.
I consider this to be a Microsoft bug: at least there ought to be a message.