Posts tagged with visual-studio - page 7

Visual Studio 2003 – System.ArgumentException in debugger

I recently ran into a problem while debugging inside Visual Studio 2003.Net. Google couldn’t find me an answer, only a few other people with the same problem. Here’s my solution in the hope it might save somebody else some time.

Symptoms

Whenever debugging a specific VB.NET application that used a C# class library I would receive the following error certain objects in the C# class library:

<error: an exception of type: {System.ArgumentException} occurred>

Strangely only the ASP.NET application was affected, the WinForms application that also used this class library was unaffected. It also seemed to be localized to the debugger only, run-time behavior appeared to be just fine.

A reboot, rebuild project or a clear down of the ASP temp directory had no effect and another developer on the project had exactly the same problem despite the fact we do not share any binaries…

Solution

Close VS and delete all bin and obj directories from all projects in your solution if you want to be totally sure.

If you really don’t want to do this, deleting the .pdb’s from the project where the messed up object lives may be enough.

You may think forcing a rebuild with “rebuild solution” would achieve this, but it does not.

Cause (optional)

While debugging I noticed that I couldn’t create the messed up object interactively either. It was complaining that no constructor took 4 arguments and that it took 3. Well, it used to take 3 – over a week ago.

This leads me to believe that some combination of changing your C# source can make either VS or the C# compiler believe the debugging symbols are still up to date when they are not. This may possibly only affect VB.NET applications compiled against it.

It must be a reproducible bug because it happened on two different machines.

[)amien