I'm trying to unit test a SharePoint (MOSS to be precise) web site. I'm trying to leverage Ivona and the maintainer of Ivona thinks this sounds (smells) like a TypeMock bug.
I'm using Windows 7 Ultimate (64 bits) and I'm getting the following error, quite odd to be honest
Test method PortalTests.UnitTest1.TestSinglePageCheckout threw exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'n' threw an exception. ---> System.Security.VerificationException: Operation could destabilize the runtime..
The full stack trace is below
n.a..ctor()
n..cctor()
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
System.Activator.CreateInstance(Type type, Boolean nonPublic)
System.Activator.CreateInstance(Type type)
System.Web.Hosting.HostingEnvironment.CreateInstance(Type type)
System.Web.Hosting.HostingEnvironment.CreateInstance(Type type)
System.Web.Hosting.ApplicationManager.CreateInstanceInNewWorkerAppDomain(Type type, String appId, VirtualPath virtualPath, String physicalPath)
System.Web.Hosting.ApplicationHost.CreateApplicationHost(Type hostType, String virtualDir, String physicalDir)
n.a(String A_0, String A_1, String A_2)
n.a(String A_0, String A_1, Boolean A_2, String A_3)
Ivonna.Framework.RunOnWebAttribute.b()
Ivonna.Framework.RunOnWebAttribute.Execute()
TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Object[] A_5)
TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected)
PortalTests.UnitTest1.TestSinglePageCheckout() in C:PortalwebTestsPortalTestsUnitTest1.cs: line 69
Any ideas? Bug in TypeMock? Bug in Ivonna? Bug in my code?
Thanks
Phil