InfoPath unable to load assembly, silently crashes

Recently I had the unpleasant experience of doing battle with an InfoPath form.
Our client had multiple servers that staff logged on to. The InfoPath form in question worked flawlessly on all but one of the terminal servers.

The Symptoms
Users were complaining that occasionally the form would outright refuse to work. They had no idea why, and InfoPath provided no error messages to them at all. Everyone was in the dark!!

The Debugging
I initially used Message Boxes as my debugging method. Crude but effective. They lead me to a single function call that was failing. But why?!
Attempting to debug properly through the Visual Studio Tools for Applications debugger on the server would let me step through the code until suddenly, the debugger would silently crash! What a mystery!!
Thankfully all it took was a try catch block around the function to reveal the true error:  a missing assembly. Specifically Microsoft.SharePoint.Client.dll

The Solution
In the InfoPath code editor (VSTA), the references to Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll required the copy local property to be set to true.
Republishing the form was all that was left. Once done, the form worked again!

What a headache


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.