Tuesday, March 17, 2015

Cannot print exception string because Exception.ToString() failed

Just to report my case of the 'Exception.ToString() Failed' error.

I was constantly working on various tasks on my machine (Windows & x64) and there would be times that I would install patches and then roll them back. 

In this particular case, I was installing a bunch of MS updates in the hope to resolve an Excel macro errors. Without success, I rolled patches back while Windows insisted to install some of the patches( I believe that I specifically asked to roll back a batch of patches, but Windows will re-install some patches after rolled back either during the shut down or the re-boot phase). 

At this point, I found that my .NET 2.0 C# code stop working. I can still compile the code but the program will simply crash without much of a clue - the compilation worked since I was able to copy the updated dll to other machines and worked just fine. I ended up testing a console program with a single WriteLine() statement. The program crashed the same way with the message 'Cannot print exception string because Exception.ToString() failed'.

I googled and there were hints that pointed to the crashed Frameworks. Even though the .NET 2.0 was failed, I was able to compiled the same code in .NET 4.0 on the same machine and it worked.I then ran into articles that state that since Windows 7 was build on .NET 2.0 and 3.5, it is impossible to install the redistributable version on Windows 7.

At that point, I was convinced that the Framework was crashed and I tried the sfc.exe in vein to fixed the problem. There seems to have a Framework tool from MS that can perform some sort of repairs. I, however, decided to check into available .net framework patches and applied them. That did the trick and the Excel, too, worked.

Possible explanation?? The only thing I can think of is that, somehow, my roll back failed the .NET 2.0, which may due to Windows insisted on install certain patches.

No comments:

Post a Comment