Horace P. Greeley
Horace P. Greeley

Reputation: 952

Getting a System.AccessViolationException with targeting framework .Net 4.5.2

Sometimes I get a System.AccessViolationException in my C# application, running on .Net 4.5.2. It seems that, the issue only occurs during debugging in Visual Studio 2013.

I had the same issue several times a day with .Net 4.5.1. Due to the Microsoft .Net bug 819552, I migrated the project to .Net 4.5.1. The issue didn't occur for a month. Unfortunately, I just got a AccessViolationException on .Net 4.5.2 as described above.

The following .Net frameworks are installed:

I need the different .Net targets, which I cannot remove.

Do you have any ideas, why the issue still occurs?

Upvotes: 3

Views: 732

Answers (1)

Hans Passant
Hans Passant

Reputation: 942187

No, you are confusing the project's Target Platform selection with the actual version of .NET you have installed on your machine. You do not have 4.5 or 4.5.1, the 4.5.2 installer replaced those versions.

Changing the project setting has no effect, you still use the version you have on the machine. The one and only you have, 4.5.2. The project setting matters only to other machines that are going to run your program. When you target 4.5.2 then those machines must have 4.5.2 installed. And your program won't run when they don't. That's almost never useful, only target the version that you require. Using 4.5 is always good enough, the api additions in 4.5.1 and 4.5.2 are very modest.

So it is entirely normal that you still see the AVE occur, nothing changed.

Upvotes: 2

Related Questions