Sunday, March 13, 2011

Unhandled exception: input string was not in a correct format

Problem:
Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.

Cause:
This problem occurs if the value of the following registry key is not empty or is set to an invalid value:
HKEY_CURRENT_USER\Control Panel\International\sPositiveSign
Here are steps to fix this problem:
1. Open registry editor. 
2. Go to: HKEY_CURRENT_USER\Control Panel\International
3. Select: sPositiveSign
4. Right Click (sPositiveSign) >> Click Modify Binary Data >> Add two pair of 2 zero’s in Value Data box as shown below >> Click OK.


Sunday, March 6, 2011

Breakpoints are not hit when debugging in Visual Studio 2010


You may not be able to debug Excel Add-In with VS2010. Here are details of this problem and steps to fix the same.

Problem:        
Excel Add-In b breakpoints are not hit when debugging in Visual Studio 2010

Reason:
This problem occurs when you debug an add-in project targeting to .NET Framework 2.0-3.5 in VS 2010. The reason is the debugger, which doesn't know what .NET Framework version your add-in uses.
To find out that info, the debugger checks the .config file of the executable, which is the host application in your case. The examples of configuration file names are outlook.exe.config and excel.exe.config; if such a file exists, it is located in the Office folder; say, for Office 2007, the folder is C:\Program Files\Microsoft Office\OFFICE12. If the .config file is missing or it doesn't point to a specific .NET Framework version, the debugger uses the debugging engine of .NET Framework 4.0.

Solution:
To help the debugger, you can create (or modify) the .config file(s) for the Office application(s) installed on your PC.

Create a Excel.exe.config file with following content. 


<xml version="1.0"?>
<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727"/>
  </startup>
</configuration>

You just need to place this file in Office folder (C:\Program Files\Microsoft Office\OFFICE12).