invalidprogramexception

Invalid program exception in release build (.NET 4.6.1)

旧街凉风 提交于 2019-12-25 08:47:50
问题 I have a program that deals with socket communication asynchronously. The exception I've been getting only occurs in release build (on build machines). The code that causes the problem is really simple routine to start listening for incoming socket connections: public async Task Listen() { try { var endpoint = new IPEndPoint(IPAddress.Loopback, Port); using (Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { Socket.Bind(endpoint); Socket.Listen(Limit);

InvalidProgramException with shims in Visual Studio 2015

人盡茶涼 提交于 2019-12-08 18:22:43
问题 An almost similar question has already been asked a while ago but not answered yet. And since my setup is a little different, I start a new try: I demonstrate a shortened version of my code, but even this short version produces the error. I have a method that returns an instance of a System.Printing.LocalPrintServer : public class PrintServerProvider { public LocalPrintServer Provide() { return new LocalPrintServer(new string[0], PrintSystemDesiredAccess.EnumerateServer); } } For this method

CLR detected an invalid program with Entity Framework

柔情痞子 提交于 2019-12-08 02:01:15
问题 I am retrieving data from a wordpress database which defines the primary key as decimal and I am using a x64 configuration on the project... The bit I searched I found out that it is the problem, but I couldn't find a solution. What do I have to do/download to be able to use decimal as a primary key? This issue on Microsoft Connect 回答1: If you're only reading data from the table you can try creating a view that casts the field to an int and then map your entity to the view. Beyond that, I