chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
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
asked by philosophil (760 points)

8 Answers

0 votes
Hi,

It's really hard to tell without the code?
Can you post it? Or send a repro solution to support AT typemock DOT com?

Thank,
answered by gilz (14.5k points)
0 votes
gilz wrote:
Can you post it? Or send a repro solution to support AT typemock DOT com?


You want me to send you a MOSS solution ?

Can you first confirm that you have tested against MOSS and that Ivana + TypeMock works as expected?

The stack trace doesn't even reach code or classes that I have written. Make sense?

Thanks

Phil
[/quote]
answered by philosophil (760 points)
0 votes
Phil,

See the at the bottom of the stack? That's your code starting the chain there. I need to at least have a look at that. Otherwise, I don't see a way to make progress.

Let's start with the unit test, and go from there. Is it possible you to post that?

Thanks,
answered by gilz (14.5k points)
0 votes
Here is the unit tests.

using Ivonna.Framework;

namespace PortalTests
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    [RunOnWeb(@"C:inetpubwwwrootwssVirtualDirectories80",@"/")]
    public class UnitTest1
    {

        [TestMethod]
        public void TestSinglePageCheckout()
        {
            var session = new TestSession();
            var page = session.GetPage("/Pages/default.aspx");
            Assert.AreEqual("Bob",page.Title);
        }
    }
}


I was just testing what would happen when I read the Assert statement. The title page isn't expected to be Bob :)

Thanks for looking into this


Phil[/code]
answered by philosophil (760 points)
0 votes
Hi Phil,

Thanks for posting this, we're going to investigation mode.

Thanks,
answered by gilz (14.5k points)
0 votes
Thanks for posting this, we're going to investigation mode


May the source be with you.

Phil[/quote]
answered by philosophil (760 points)
0 votes
Any progress made on this?

My 10 days license is now gone. So I guess I won't even be able to test a fix.

Oh well.
answered by philosophil (760 points)
0 votes
Hi Phil,

First let's extend your evaluation license so you'll be able to continue using Isolator.

I'd like to investigate this and I need a proper repro of this issue - let's take it offline.
answered by dhelper (11.9k points)
...