Monday, June 29, 2009

[2009.06.29] Visual Studio: AccessViolationException and BitDefender

I recently ran into an error that was annoying so I think it is worth its own post. Basically, I started getting a AccessViolationException error when I tried to run my code in Debug Mode and could not figure out what was going on. Even with a brand new Console Application I was getting the error.

It turns out the culprit was BitDefender. The previous night I was screwing around with Visual Studio and somehow moving tabs around caused BD to think that VS was executing malicious code. A warning popped up and instead of reading it (doh!), I just clicked it away. The next day my headaches started. Basically, Visual Studio was added to the Behavioral Scanner list under the Anitvirus tab.

So if you are running Visual Studio and BitDefender and you start getting the AccessViolationException error, delete the Visual Studio entry from the Behavioral Scanner list and you should be just fine. I would assume that this may apply for other antivirus software out there.

Update:[2009-06-30] I do not think this is just a BitDefender error as I have run into it again and it seems to be just a Visual Studio 2010 Beta 1 error. I am in the middle of a project that refuses to debug at all. XAML IntelliSense is non functioning as well. But VS2008 seems fine so far. This is really annoying!

Update 2: [2009-07-01] One thing I didn't mention earlier is that I reformatted and reinstalled Windows Server 2008 x64, but now with SP2. The thing is that I had both VS2008 SP1 and VS2010 B1 running side by side in with SP1 and the exact same version of Bitdefender, and I had no problems at all. Now I am not even sure if the AccessViolationException is a SP2 issue or not. For now, I turned off vshost.exe in both versions of VS and now I can debug. In the Solution Explorer, right click the name of the project you are using, select Properties, select the Debug tab, and scroll down and uncheck the Enable the Visual Studio Hosting Process. As soon as I do this, everything works.

2 comments:

Bene said...

Hey! Thank you very much! i searched at google but i didnt find anything... and now - i found that info and at the moment its working fine! thake you!

Sparky Dasrath said...

Yeah it was kind of annoying not to be able to pinpoint the issue. So far, as soon as I start a project, I turn off the VS hosting process and it works fine.