0

Gotchas- InfoPath 2010

Error1:

I have encountered the following error “Microsoft InfoPath has stopped working” while trying to open VSTA (Microsoft Visual Studio Tools for Applications) via the InfoPath form. I was trying to leverage ‘Edit from Code’ option available in InfoPath. I tried  troubleshooting for a while, searched for errors in my event log and researched a bit to find a solution. But failed! The following solution did work for me, but there could be hundred different reasons why it failed on you. Hopefully the following solution saves some time for you

Solution: For unknown reasons VSTA failed to locate the code that it was referencing previously. I have deleted the references to code using ‘Remove Code’ option in InfoPath and reattached the code and everything worked fine seamlessly! This basically involves navigating to Developer>Language> Form Options> Programming> Remove Code. After completing this, point ‘Project Location’ to where the form code existed before and hit ‘OK’.

Error2:

Task failed because “sgen.exe” was not found, or the .NET Framework SDK v2.0 is not installed.  The task is looking for “sgen.exe” in the “bin” subdirectory beneath the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NETFramework.  You may be able to solve the problem by doing one of the following:  1.) Install the .NET Framework SDK v2.0.  2.) Manually set the above registry key to the correct location.  3.) Pass the correct location into the “ToolPath” parameter of the task

Solution:

This error started coming up when I added web reference to VSTA and started to build the application. The whole error is all about the setting in the project settings “Generate Serialization Assembly” this setting was initially “Auto” so I have set this to “Off” and the build was successful. When the the setting was set to “Auto” the VSTA was trying to find sgen.exe (XML Serializer Generator –  this tool creates an XML serialization assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types).

Error3:

I have encountered the following error while I tried to run my VSTA that loads my InfoPath form to debug. “InfoPath cannot open files selected forms because of an error in the form code. Policy settings prevent opening Internet forms with managed code. To fix this problem, contact your system administrator

Solution: 

It appears that some forms need to be in full trust if they contain managed code. I gave the form ‘Full trust’. This scenario works for me and might not fit well with your environment, please be cautious when using this option as this will enable InfoPath form to access files and settings on the computer.

Leave a Reply