AccessViolationException when specific code is missing while debugging

I get AccessViolationException

when debugging an application, but I don't get this exception when running this application as a release with no debugger attached. The application is a very thread-like (up to 10000+) network server (tcp / socket).

The app went through all last night compiled as release, no debugger attached and under heavy load. In fact, an application never crashes without a debugger attached.

When I run my application compiled as Release

with a debugger attached, I get AccessViolationException

-Exception (sometimes). This exception is simply thrown without any hint where this exception occurs. When I click Ok on the popping up exception in Visual Studio and then go to the thread where the exception happened. I don't see any code or stacktrace there:

Thread with exception has no memory-location. (Topic # 186840 has no memory location.)

This is my (abbreviated) test program: example code . (You must have enough bar and cpu and must compile as release. Start the server application first and then build the load with the client application.)

Now my question (s) is: How can I debug errors like this? Does anyone know of a bug in .NET when debugging such thread-intensive programs?

I am using Visual Studio 2013 Update 4. Project - Any Cpu

; .NET 4.0

C#

... I installed all Windows updates and ran this on Windows 8.1. The JIT compiler compiled the code for x64.

+3


source to share





All Articles