开发者

C# WinForms exception: A first chance exception of type 'System.AccessViolationException'

I have a basic WinForms application. I'm making a call to an external API which is generating the following exception:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

A first chance exception of type 'System.AccessViolationException' occurred in UavController.exe

The call looks like this:

outputBroker.SelectedObjectPaths.AddWithID(((AgAircraft)aircraft).Path, ((AgAircraft)aircraft).InstanceName);开发者_运维技巧

I can't find any indication of the problem.


The issue is one generated by your API. Either you are passing in bad data to the API through your call or your API has an issue on its own. Here is a Microsoft link that might help you if you have access to the code of your API:

http://msdn.microsoft.com/en-us/library/ms164911(v=vs.80).aspx

Otherwise, I think you might need to work with your API provider to figure out what the issue is and how to resolve it.


A first chance exception isn't always a bug. A first chance exception is the first time an exception was thrown by code that you are debugging. If your code handles the exception, then all this serves to do is notify you that an exception occurred.

For example, I may have code that attempts to find a file with a specific name and if found, does certain things. If the file name doesn't exist, an exception is throw, which I handle and take other action. So, though an exception occurs, it is expected behavior and handled by code.

If you're having second chance exception notifications, this means that your code doesn't actually handle the exception that was thrown. At that point, you'd want to look at what's going on. Are you just re-throwing the exception again for higher level code to capture or are you ignoring it altogether.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜