Comment 18 for bug 1064804

Revision history for this message
Jv (jv-ravichandran) wrote : Re: [Bug 1064804] [NEW] Test throws an exception in NUnit but works when running in MSTest or as a Console application

Hi,

From the start,

>> Common sources of this bug include user marshaling errors for
COM-interop or PInvoke, which may corrupt the stack.

1. When working in the unmanaged context, it is worth trying the STAThread
attribute on the method.

>> ax.LogonAs("User1", "Globe", new NetworkCredential("User1", "pwd",
"Globe"

2. Try adding a role for the user with ax32.exe (if it already exists,
please post the role). Plus test permission sets and any admin tasks that
was done during installation of Ax.

3. It looks like with messages on "marshalling" and Domain usage: Single,
it could well be related to the CLR, the GAC and the Dll context. These are
vague references that can be clarified if you walk us through your
installation type of AX, the CLR version, the roles and permission sets.

Jv

On Wed, Oct 10, 2012 at 7:58 AM, Mun Wai Chan
<email address hidden>wrote:

> Public bug reported:
>
> Hi,
>
> I have a simple test which throws an error when I run it using NUnit
> (fails on both NUnit GUI/console and Resharper in VS). However, if ran
> using Visual Studio's Test -> Debug option or as a Console application,
> it runs fine. The code is exactly the same for the 3 different projects
> types (NUnit, Console and MSTest).
>
> Source code for NUnit test:
>
> using System.Net;
> using Microsoft.Dynamics.BusinessConnectorNet;
> using Microsoft.VisualStudio.TestTools.UnitTesting;
>
> namespace TestProject1
> {
> [TestClass]
> public class UnitTest1
> {
> [TestMethod]
> public void TestMethod1()
> {
> Axapta ax = new Axapta();
> ax.LogonAs("User1", "Globe", new NetworkCredential("User1",
> "pwd", "Globe"), default(string), default(string),
> "A6BuildTestAos:6004", default(string));
> ax.Logoff();
> }
> }
> }
>
> Error:
>
> FatalExecutionEngineError was detected.
> The runtime has encountered a fatal error. The address of the error was at
> 0x5785ca87, on thread 0x792c. The error code is 0xc0000005. This error may
> be a bug in the CLR or in the unsafe or non-verifiable portions of user
> code. Common sources of this bug include user marshaling errors for
> COM-interop or PInvoke, which may corrupt the stack.
>
> Thanks in advance.
>
> ** Affects: nunitv2
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
> https://bugs.launchpad.net/bugs/1064804
>
> Title:
> Test throws an exception in NUnit but works when running in MSTest or
> as a Console application
>
> Status in NUnit V2 Test Framework:
> New
>
> Bug description:
> Hi,
>
> I have a simple test which throws an error when I run it using NUnit
> (fails on both NUnit GUI/console and Resharper in VS). However, if ran
> using Visual Studio's Test -> Debug option or as a Console
> application, it runs fine. The code is exactly the same for the 3
> different projects types (NUnit, Console and MSTest).
>
> Source code for NUnit test:
>
> using System.Net;
> using Microsoft.Dynamics.BusinessConnectorNet;
> using Microsoft.VisualStudio.TestTools.UnitTesting;
>
> namespace TestProject1
> {
> [TestClass]
> public class UnitTest1
> {
> [TestMethod]
> public void TestMethod1()
> {
> Axapta ax = new Axapta();
> ax.LogonAs("User1", "Globe", new NetworkCredential("User1",
> "pwd", "Globe"), default(string), default(string),
> "A6BuildTestAos:6004", default(string));
> ax.Logoff();
> }
> }
> }
>
> Error:
>
> FatalExecutionEngineError was detected.
> The runtime has encountered a fatal error. The address of the error was
> at 0x5785ca87, on thread 0x792c. The error code is 0xc0000005. This error
> may be a bug in the CLR or in the unsafe or non-verifiable portions of user
> code. Common sources of this bug include user marshaling errors for
> COM-interop or PInvoke, which may corrupt the stack.
>
> Thanks in advance.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunitv2/+bug/1064804/+subscriptions
>

--
Regards,

Ravichandran Jv
http://ravichandranjv.blogspot.com