When trying to deploy a SharePoint 2010 solution from Visual Studio 2010, I'm getting the following error:
Error occurred in deployment step 'Add Solution': The type initializer for 'Singleton' threw an exception.
The code for this class lives in another assembly and looks like this:
public class ServiceLocator<T> where T : new()
{
// Other code in class left out for clarity...
public static T Current
{
get
{
return Singleton.Instance;
}
}
class Singleton
{
internal static readonly T Instance = new T();
static Singleton() { }
}
}
The class itself has work before and I'm have been able to deploy this code, so the issue probably doesn't have something to do with the class itself.
What can be the cause of this? How can I troubleshoot this myself? Can I see more error details somewhere?