Test throws an exception in NUnit but works when running in MSTest or as a Console application

Bug #1064804 reported by Mun Wai Chan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit Framework
New
Undecided
Unassigned

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.

Revision history for this message
Charlie Poole (charlie.poole) wrote :

We'll accept the bug, in order to make the info about it available to other users. Assuming that the Axapta class relates to the Microsoft product of the same name, there isn't much we can do about fixing it without a lot more information. We don't have access to the product in question.

The test you included is not actually an NUnit test, since it uses MsTest attributes. Can we assume you changed the attributes when running under NUnit?

Charlie

Revision history for this message
Mun Wai Chan (munwai) wrote :

Hi Charlie,

I must have pasted in the code from the MSTest project but it is definitely using the Nunit attributes. We only use NUnit and just found this bug yesterday and so we decided to test with MSTest to confirm if it is a NUnit thing.

That is my main concern which is you not having access to the product. Is there anything I can do to make it easier to debug? Maybe a Goto Meeting or something? I can send you the Microsoft dll that is involved which is the .Net Business Connector dll but you would still need to have a system to try connecting to for the error to occur.

Please let me know what I can do to help you fix this bug (if possible).

Thanks,

Mun Wai

Revision history for this message
Mun Wai Chan (munwai) wrote :

Charlie,

FYI, the software is also available on MSDN if you have an account with them.

Regards,

Mun Wai

Revision history for this message
Charlie Poole (charlie.poole) wrote : Re: [Bug 1064804] Re: Test throws an exception in NUnit but works when running in MSTest or as a Console application

Lets try some easier stuff first. If you isolate the tests by running
them in a separate process from NUnit, what happens?

Charlie

On Tue, Oct 9, 2012 at 9:01 PM, Mun Wai Chan
<email address hidden> wrote:
> Charlie,
>
> FYI, the software is also available on MSDN if you have an account with
> them.
>
> Regards,
>
> Mun Wai
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.launchpad.net/bugs/1064804
>
> Title:
> Test throws an exception in NUnit but works when running in MSTest or
> as a Console application
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunitv2/+bug/1064804/+subscriptions

Revision history for this message
Mun Wai Chan (munwai) wrote :

As mentioned above, I ran it in a Console app and it worked.

using Microsoft.Dynamics.BusinessConnectorNet;

namespace ConsoleApplication1
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Axapta ax = new Axapta();
            ax.LogonAs("User1", "Globe", new NetworkCredential("User1", "pwd", "Globe"), default(string), default(string), "A6BuildTestAos:6004", default(string));
            ax.Logoff();
        }
    }
}

Revision history for this message
Charlie Poole (charlie.poole) wrote :

Right, but I'm suggesting you run it under NUnit using process
isolation. You can do that by using the Settings menu, which
includes a page for specifying how tests are loaded.

Charlie

On Tue, Oct 9, 2012 at 10:27 PM, Mun Wai Chan
<email address hidden> wrote:
> As mentioned above, I ran it in a Console app and it worked.
>
> using Microsoft.Dynamics.BusinessConnectorNet;
>
> namespace ConsoleApplication1
> {
> public class Program
> {
> public static void Main(string[] args)
> {
> Axapta ax = new Axapta();
> ax.LogonAs("User1", "Globe", new NetworkCredential("User1", "pwd", "Globe"), default(string), default(string), "A6BuildTestAos:6004", default(string));
> ax.Logoff();
> }
> }
> }
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.launchpad.net/bugs/1064804
>
> Title:
> Test throws an exception in NUnit but works when running in MSTest or
> as a Console application
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunitv2/+bug/1064804/+subscriptions

Revision history for this message
Mun Wai Chan (munwai) wrote :

Sorry, I misunderstood you. Is below what you meant?

I loaded the unit test dll using the NUnit gui and went to Tools -> Settings -> Assembly Isolation.

Tried running in all 3 options

1) Run tests directly in NUnit process.
2) Run tests in single separate process.
3) Run tests in a seperate process per Assembly.

And all 3 options crashes the NUnit gui.

Revision history for this message
Simone Busoli (simone.busoli) wrote : Re: [Nunit-core] [Bug 1064804] Re: Test throws an exception in NUnit but works when running in MSTest or as a Console application
Download full text (3.4 KiB)

I've found several reports of people complaining about a similar issue,
although there's not much information in them. In general they seem to be
related to the host of the application, that is, works in console but
breaks in ASP.NET, for instance.

The first thing I would try is to simulate with NUnit what MSTest (I guess)
does. Start by running the tests using nunit-console.exe and see if
anything changes.
Then if your project is compiled for >= .NET 4.0 please modify the
nunit-console.exe.config file by forcing the nunit to run under >= .NET 4.0
ONLY: http://msdn.microsoft.com/en-us/library/w4atty68.aspx

https://groups.google.com/forum/?fromgroups=#!topic/microsoft.public.axapta.programming/zrcHzjLHBm4
http://mailarchiver.org/mail/topic/web-applications-crashes-when-using-netbusinessconnector-11521030
https://community.dynamics.com/product/ax/f/33/p/22895/36688.aspx

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

> Sorry, I misunderstood you. Is below what you meant?
>
> I loaded the unit test dll using the NUnit gui and went to Tools ->
> Settings -> Assembly Isolation.
>
> Tried running in all 3 options
>
> 1) Run tests directly in NUnit process.
> 2) Run tests in single separate process.
> 3) Run tests in a seperate process per Assembly.
>
> And all 3 options crashes the NUnit gui.
>
> --
> 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/nuni...

Read more...

Revision history for this message
Mun Wai Chan (munwai) wrote :

I have actually tried the above previously before giving up as I had no idea what else can be different.

I added the following to the nunit-console-x86.exe.config.

<startup useLegacyV2RuntimeActivationPolicy="true">
   <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>

And then ran the test using the following command:

        nunit-console-x86.exe ClassLibrary1.dll

And the console crashed.

Revision history for this message
Mun Wai Chan (munwai) wrote :

The weird thing is running MSTest in Visual Studio works but running it under Resharper does not. And for Nunit, both NUnit console, gui and Resharper produced the same error.

Revision history for this message
Simone Busoli (simone.busoli) wrote :

With the same exception, I guess (look at the event log eventually). What
about the non-x86 version of the console?

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

> I have actually tried the above previously before giving up as I had no
> idea what else can be different.
>
> I added the following to the nunit-console-x86.exe.config.
>
> <startup useLegacyV2RuntimeActivationPolicy="true">
> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
> </startup>
>
> And then ran the test using the following command:
>
> nunit-console-x86.exe ClassLibrary1.dll
>
> And the console crashed.
>
> --
> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~nunit-core
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~nunit-core
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Mun Wai Chan (munwai) wrote :

The event logs are showing the following:

1) Application: nunit-console-x86.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 5785CA87 (57840000) with exit code 80131506.

2) Faulting application name: nunit-console-x86.exe, version: 2.5.5.10112, time stamp: 0x4bd0d2b3
Faulting module name: clr.dll, version: 4.0.30319.17929, time stamp: 0x4ffa5753
Exception code: 0xc0000005
Fault offset: 0x0001ca87
Faulting process id: 0x3738
Faulting application start time: 0x01cda6c39f7339f7
Faulting application path: c:\Program Files (x86)\NUnit 2.5.5\bin\net-2.0\nunit-console-x86.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report Id: dec260e7-12b6-11e2-8130-00248c544315

The non-x86 will not work because this is a Microsoft Dynamics AX 4 business connector and there is only a 32 bit version of it. Running the following will give an error of:

NUnit version 2.5.5.10112
Copyright (C) 2002-2009 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
   OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
  CLR Version: 4.0.30319.17929 ( Net 4.0 )

ProcessModel: Default DomainUsage: Single
Execution Runtime: net-4.0
Could not load file or assembly 'ClassLibrary1' or one of its dependencies. The
system cannot find the file specified.

Revision history for this message
Mun Wai Chan (munwai) wrote :

Also, setting the project platform to x64 will produce the following error.

NUnit version 2.5.5.10112
Copyright (C) 2002-2009 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
   OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
  CLR Version: 4.0.30319.17929 ( Net 4.0 )

ProcessModel: Default DomainUsage: Single
Execution Runtime: net-4.0
.F
Tests run: 1, Errors: 1, Failures: 0, Inconclusive: 0, Time: 0.344 seconds
  Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0

Errors and Failures:
1) Test Error : ClassLibrary1.Class1.Test
   System.BadImageFormatException : Could not load file or assembly 'Microsoft.D
ynamics.BusinessConnectorNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=3
1bf3856ad364e35' or one of its dependencies. An attempt was made to load a progr
am with an incorrect format.
   at ClassLibrary1.Class1.Test()

Revision history for this message
Simone Busoli (simone.busoli) wrote :
Download full text (4.3 KiB)

Hi,

I still don't have clear if your project is compiled for .NET 2-3.5 or 4.x.
I assume it's the former, so let's exclude x64 and .NET 4.0. Please also
try to use a more recent version of NUnit as you're still using 2.5 (the
most recent is 2.6.1).
Then please run nunit-console-x86 under .NET 2.0 (remove the .config
changes basically) against your project compiled for Any CPU (or x86) and
paste what you see in the EventLog.

If you still get:

Could not load file or assembly 'ClassLibrary1' or one of its dependencies.
The system cannot find the file specified.

Please provide the fusion log.

Simone

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

> The event logs are showing the following:
>
> 1) Application: nunit-console-x86.exe
> Framework Version: v4.0.30319
> Description: The process was terminated due to an internal error in the
> .NET Runtime at IP 5785CA87 (57840000) with exit code 80131506.
>
> 2) Faulting application name: nunit-console-x86.exe, version: 2.5.5.10112,
> time stamp: 0x4bd0d2b3
> Faulting module name: clr.dll, version: 4.0.30319.17929, time stamp:
> 0x4ffa5753
> Exception code: 0xc0000005
> Fault offset: 0x0001ca87
> Faulting process id: 0x3738
> Faulting application start time: 0x01cda6c39f7339f7
> Faulting application path: c:\Program Files (x86)\NUnit
> 2.5.5\bin\net-2.0\nunit-console-x86.exe
> Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
> Report Id: dec260e7-12b6-11e2-8130-00248c544315
>
> The non-x86 will not work because this is a Microsoft Dynamics AX 4
> business connector and there is only a 32 bit version of it. Running the
> following will give an error of:
>
> NUnit version 2.5.5.10112
> Copyright (C) 2002-2009 Charlie Poole.
> Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A.
> Vorontsov.
> Copyright (C) 2000-2002 Philip Craig.
> All Rights Reserved.
>
> Runtime Environment -
> OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
> CLR Version: 4.0.30319.17929 ( Net 4.0 )
>
> ProcessModel: Default DomainUsage: Single
> Execution Runtime: net-4.0
> Could not load file or assembly 'ClassLibrary1' or one of its
> dependencies. The
> system cannot find the file specified.
>
> --
> 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
> {...

Read more...

Revision history for this message
Mun Wai Chan (munwai) wrote :

Hi Simone,

I did what you said as above.

1) Compiled it as .Net 2.0 and x86.
2) Remove the config changes.
3) Run nunit-console-x86

And it still crashes. The event logs are below.

1) .NET Runtime version 2.0.50727.5456 - Fatal Execution Engine Error (79AFEABE) (80131506)
2) Faulting application name: nunit-console-x86.exe, version: 2.5.5.10112, time stamp: 0x4bd0d2b3
Faulting module name: mscorwks.dll, version: 2.0.50727.5456, time stamp: 0x4ef6c72d
Exception code: 0xc0000005
Fault offset: 0x0000ee3b
Faulting process id: 0x%9
Faulting application start time: 0x%10
Faulting application path: %11
Faulting module path: %12
Report Id: %13

Mun Wai

Revision history for this message
Mun Wai Chan (munwai) wrote :

I am sorry, I missed the part about using the latest version. I installed the latest version and ran it.

E:\New folder (3)\ClassLibrary1\bin\Debug>"c:\Program Files (x86)\NUnit 2.6.1\bi
n\nunit-console-x86.exe" ClassLibrary1.dll
NUnit-Console version 2.6.1.12217
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
   OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
  CLR Version: 2.0.50727.5456 ( Net 3.5 )

ProcessModel: Default DomainUsage: Single
Execution Runtime: net-3.5
.

And it crashes as well. The event logs are:

1) .NET Runtime version 2.0.50727.5456 - Fatal Execution Engine Error (79AFEABE) (80131506)
2) Faulting application name: nunit-console-x86.exe, version: 2.6.1.12217, time stamp: 0x501da46b
Faulting module name: mscorwks.dll, version: 2.0.50727.5456, time stamp: 0x4ef6c72d
Exception code: 0xc0000005
Fault offset: 0x0000ee3b
Faulting process id: 0x%9
Faulting application start time: 0x%10
Faulting application path: %11
Faulting module path: %12
Report Id: %13

Revision history for this message
Simone Busoli (simone.busoli) wrote :
Download full text (3.2 KiB)

Hmm, not very helpful, I'm afraid. Let's see if Charlie has any other
ideas. We might also consider inspecting a crash dump if you can generate
one.
In some of the links I sent they suggested that updating to a more recent
version of the Business Connector might solve the problem, do you have any
chance to try it?

On Wed, Oct 10, 2012 at 2:56 PM, Mun Wai Chan
<email address hidden>wrote:

> Hi Simone,
>
> I did what you said as above.
>
> 1) Compiled it as .Net 2.0 and x86.
> 2) Remove the config changes.
> 3) Run nunit-console-x86
>
> And it still crashes. The event logs are below.
>
> 1) .NET Runtime version 2.0.50727.5456 - Fatal Execution Engine Error
> (79AFEABE) (80131506)
> 2) Faulting application name: nunit-console-x86.exe, version: 2.5.5.10112,
> time stamp: 0x4bd0d2b3
> Faulting module name: mscorwks.dll, version: 2.0.50727.5456, time stamp:
> 0x4ef6c72d
> Exception code: 0xc0000005
> Fault offset: 0x0000ee3b
> Faulting process id: 0x%9
> Faulting application start time: 0x%10
> Faulting application path: %11
> Faulting module path: %12
> Report Id: %13
>
>
> Mun Wai
>
> --
> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~nunit-core
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~nunit-core
> More help ...

Read more...

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
Download full text (4.2 KiB)

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.Un...

Read more...

Revision history for this message
Mun Wai Chan (munwai) wrote :

Hi Simone,

The version of Ax I am using is the latest. (Ax 4 SP2).

What tool should I use to create a crashdump. I tried Microsoft's DebugDiag but it doesn't seem to capture the dump when running nunit-console-x86 from the command prompt.

Mun Wai

Revision history for this message
Mun Wai Chan (munwai) wrote :

Hi Jv,

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

Tried adding this and it still crashes.

>>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.

I am a domain and Ax admin.

>>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.

The thing is why does it work for MSTest but not NUnit? Which makes me think that it is not related to permissions.

Thanks,

Mun Wai

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

It may be related to the AppDomain (s) that are being used.

Are you sure the attribute on your class is [TestFixture] when you run the
test in NUnit?

Jv

On Thu, Oct 11, 2012 at 7:06 AM, Mun Wai Chan
<email address hidden>wrote:

> Hi Jv,
>
> >>1. When working in the unmanaged context, it is worth trying the
> STAThread
> attribute on the method.
>
> Tried adding this and it still crashes.
>
> >>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.
>
> I am a domain and Ax admin.
>
> >>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.
>
> The thing is why does it work for MSTest but not NUnit? Which makes me
> think that it is not related to permissions.
>
> Thanks,
>
> Mun Wai
>
> --
> 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

Revision history for this message
Mun Wai Chan (munwai) wrote :

Yup. I have 3 separate projects in one solution (NUnit, Console and MSTest). Below is the source code for NUnit.

using System;
using System.Net;
using Microsoft.Dynamics.BusinessConnectorNet;
using NUnit.Framework;

namespace ClassLibrary1
{
    [TestFixture]
    public class Class1
    {
        [Test]
        public void Test()
        {
                Axapta ax = new Axapta();
                ax.LogonAs("User1", "Globe", new NetworkCredential("User1", "pwd", "Globe"), default(string),
                           default(string), "devaos2:2714", default(string));
                ax.Logoff();
        }
    }
}

Revision history for this message
Charlie Poole (charlie.poole) wrote :
Download full text (3.6 KiB)

The absense of a TestFixture attribute is not going to crash NUnit.

Charlie

On Wed, Oct 10, 2012 at 7:52 PM, Jv <email address hidden> wrote:
> It may be related to the AppDomain (s) that are being used.
>
> Are you sure the attribute on your class is [TestFixture] when you run the
> test in NUnit?
>
> Jv
>
> On Thu, Oct 11, 2012 at 7:06 AM, Mun Wai Chan
> <email address hidden>wrote:
>
>> Hi Jv,
>>
>> >>1. When working in the unmanaged context, it is worth trying the
>> STAThread
>> attribute on the method.
>>
>> Tried adding this and it still crashes.
>>
>> >>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.
>>
>> I am a domain and Ax admin.
>>
>> >>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.
>>
>> The thing is why does it work for MSTest but not NUnit? Which makes me
>> think that it is not related to permissions.
>>
>> Thanks,
>>
>> Mun Wai
>>
>> --
>> 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/+subscri...

Read more...

Revision history for this message
Jv (jv-ravichandran) wrote :

In the Tools->Settings dialog is a TestLoader option that sets the
PrincipalPolicy. Have you seen the setting (unchecked by default).

Jv

On Thu, Oct 11, 2012 at 8:33 AM, Mun Wai Chan
<email address hidden>wrote:

> Yup. I have 3 separate projects in one solution (NUnit, Console and
> MSTest). Below is the source code for NUnit.
>
> using System;
> using System.Net;
> using Microsoft.Dynamics.BusinessConnectorNet;
> using NUnit.Framework;
>
> namespace ClassLibrary1
> {
> [TestFixture]
> public class Class1
> {
> [Test]
> public void Test()
> {
> Axapta ax = new Axapta();
> ax.LogonAs("User1", "Globe", new
> NetworkCredential("User1", "pwd", "Globe"), default(string),
> default(string), "devaos2:2714",
> default(string));
> ax.Logoff();
> }
> }
> }
>
> --
> 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

Revision history for this message
Mun Wai Chan (munwai) wrote :

The option Set principal policy is unchecked in Tools -> Settings -> Test Loader -> Advanced.

Revision history for this message
Jv (jv-ravichandran) wrote :

NetworkCredential works on challenge, I believe, so please confirm if your
console app has the same code as the test call. Is "Globe" the fully
qualified domain name? I think that it has got to do with
security/authentication/proxyId of your logonAs method.

Jv

On Thu, Oct 11, 2012 at 8:33 AM, Mun Wai Chan
<email address hidden>wrote:

> Yup. I have 3 separate projects in one solution (NUnit, Console and
> MSTest). Below is the source code for NUnit.
>
> using System;
> using System.Net;
> using Microsoft.Dynamics.BusinessConnectorNet;
> using NUnit.Framework;
>
> namespace ClassLibrary1
> {
> [TestFixture]
> public class Class1
> {
> [Test]
> public void Test()
> {
> Axapta ax = new Axapta();
> ax.LogonAs("User1", "Globe", new
> NetworkCredential("User1", "pwd", "Globe"), default(string),
> default(string), "devaos2:2714",
> default(string));
> ax.Logoff();
> }
> }
> }
>
> --
> 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

Revision history for this message
Mun Wai Chan (munwai) wrote :

Yup. I copied and paste the code into each project. They are exactly the same code, line for line.

Revision history for this message
Jv (jv-ravichandran) wrote :

Here is some help -
http://msdn.microsoft.com/en-us/library/microsoft.dynamics.businessconnectornet.axapta.logonas.aspx

On Thu, Oct 11, 2012 at 8:53 AM, Mun Wai Chan
<email address hidden>wrote:

> The option Set principal policy is unchecked in Tools -> Settings ->
> Test Loader -> Advanced.
>
> --
> 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

Revision history for this message
Jv (jv-ravichandran) wrote :

Attach the NUnit process to VS Debugger and see at which breakpoint it
crashes.

On Thu, Oct 11, 2012 at 9:11 AM, Mun Wai Chan
<email address hidden>wrote:

> Yup. I copied and paste the code into each project. They are exactly the
> same code, line for line.
>
> --
> 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

Revision history for this message
Mun Wai Chan (munwai) wrote :

Just to prove that it has nothing to do with the Network Credentials, I have used the Logon method instead and it crashes as well.

using Microsoft.Dynamics.BusinessConnectorNet;
using NUnit.Framework;

namespace ClassLibrary1
{
    [TestFixture]
    public class Class1
    {
        [Test]
        public void Test()
        {
                Axapta ax = new Axapta();
                ax.Logon(null, null, "devaos2:2714", null);
                ax.Logoff();
        }
    }
}

Revision history for this message
Mun Wai Chan (munwai) wrote :

It crashes on the Logon/LogonAs method.

Revision history for this message
Jv (jv-ravichandran) wrote :

ExpectedException should tell you the exception then.

On Thu, Oct 11, 2012 at 9:31 AM, Mun Wai Chan
<email address hidden>wrote:

> It crashes on the Logon/LogonAs method.
>
> --
> 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

Revision history for this message
Mun Wai Chan (munwai) wrote :

The exception is mentioned above if that is what you meant.

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.

Revision history for this message
Jv (jv-ravichandran) wrote :

Must have missed it. Browsers handle http errors like 404 but the same
cannot be said for apps. Will respond if I get something.

Jv

On Thu, Oct 11, 2012 at 9:59 AM, Mun Wai Chan
<email address hidden>wrote:

> The exception is mentioned above if that is what you meant.
>
> 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.
>
> --
> 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

Revision history for this message
Simone Busoli (simone.busoli) wrote : Re: [Nunit-core] [Bug 1064804] Re: Test throws an exception in NUnit but works when running in MSTest or as a Console application

Hi Mun,

you can try this:
http://stackoverflow.com/questions/4992569/how-do-i-obtain-a-crash-dump

On Thu, Oct 11, 2012 at 3:34 AM, Mun Wai Chan
<email address hidden>wrote:

> Hi Simone,
>
> The version of Ax I am using is the latest. (Ax 4 SP2).
>
> What tool should I use to create a crashdump. I tried Microsoft's
> DebugDiag but it doesn't seem to capture the dump when running nunit-
> console-x86 from the command prompt.
>
> Mun Wai
>
> --
> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~nunit-core
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~nunit-core
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Mun Wai Chan (munwai) wrote :

Does this help?

E:\New folder (3)>procdump.exe -ma -e 1 -f "" -x "e:\New folder (3)" "c:\Program
 Files (x86)\NUnit 2.6.1\bin\nunit-x86.exe"

ProcDump v5.00 - Writes process dump files
Copyright (C) 2009-2012 Mark Russinovich
Sysinternals - www.sysinternals.com
With contributions from Andrew Richards

Process: nunit-x86.exe (26956)
CPU threshold: n/a
Performance counter: n/a
Commit threshold: n/a
Threshold seconds: n/a
Number of dumps: 1
Hung window check: Disabled
Exception monitor: First Chance+Unhandled
Exception filter: Display Only
Terminate monitor: Disabled
Dump file: e:\New folder (3)\nunit-x86.dmp

Press Ctrl-C to end monitoring without terminating the process.

CLR Version: v2.0.50727

[10:59:29] Exception: 80000003.BREAKPOINT
[10:59:29] Exception: 80000004.SINGLE_STEP
[10:59:29] Exception: 80000003.BREAKPOINT
[10:59:39] Exception: 000006BA
[10:59:42] Exception: E06D7363.PAVEEFileLoadException@@
[10:59:42] Exception: E06D7363.msc
[10:59:42] Exception: E06D7363.PAVEEFileLoadException@@
[10:59:42] Exception: E06D7363.msc
[10:59:42] Exception: E06D7363.PAVEEFileLoadException@@
[10:59:42] Exception: E06D7363.msc
[10:59:42] Exception: E06D7363.PAVEEFileLoadException@@
[10:59:42] Exception: E0434F4D.System.IO.FileNotFoundException
[10:59:45] Exception: 80000003.BREAKPOINT
[10:59:45] Exception: 80000004.SINGLE_STEP
[10:59:45] Exception: 80000003.BREAKPOINT
[10:59:45] Exception: 80000004.SINGLE_STEP
[10:59:45] Exception: 80000003.BREAKPOINT
[10:59:45] Exception: 80000003.BREAKPOINT
[10:59:45] Exception: 80000004.SINGLE_STEP
[10:59:45] Exception: 80000003.BREAKPOINT
[10:59:45] Exception: 80000004.SINGLE_STEP
[10:59:45] Exception: 80000003.BREAKPOINT
[10:59:45] Exception: 80000003.BREAKPOINT
[10:59:47] Exception: 000006D9
[10:59:47] Exception: 000006D9
[10:59:48] Exception: C0000005.ACCESS_VIOLATION
The process has exited.

Revision history for this message
Simone Busoli (simone.busoli) wrote :
Download full text (4.2 KiB)

Could you attach the crash dump or send it privately via email?

On Fri, Oct 12, 2012 at 5:00 AM, Mun Wai Chan
<email address hidden>wrote:

> Does this help?
>
> E:\New folder (3)>procdump.exe -ma -e 1 -f "" -x "e:\New folder (3)"
> "c:\Program
> Files (x86)\NUnit 2.6.1\bin\nunit-x86.exe"
>
> ProcDump v5.00 - Writes process dump files
> Copyright (C) 2009-2012 Mark Russinovich
> Sysinternals - www.sysinternals.com
> With contributions from Andrew Richards
>
> Process: nunit-x86.exe (26956)
> CPU threshold: n/a
> Performance counter: n/a
> Commit threshold: n/a
> Threshold seconds: n/a
> Number of dumps: 1
> Hung window check: Disabled
> Exception monitor: First Chance+Unhandled
> Exception filter: Display Only
> Terminate monitor: Disabled
> Dump file: e:\New folder (3)\nunit-x86.dmp
>
>
> Press Ctrl-C to end monitoring without terminating the process.
>
> CLR Version: v2.0.50727
>
> [10:59:29] Exception: 80000003.BREAKPOINT
> [10:59:29] Exception: 80000004.SINGLE_STEP
> [10:59:29] Exception: 80000003.BREAKPOINT
> [10:59:39] Exception: 000006BA
> [10:59:42] Exception: E06D7363.PAVEEFileLoadException@@
> [10:59:42] Exception: E06D7363.msc
> [10:59:42] Exception: E06D7363.PAVEEFileLoadException@@
> [10:59:42] Exception: E06D7363.msc
> [10:59:42] Exception: E06D7363.PAVEEFileLoadException@@
> [10:59:42] Exception: E06D7363.msc
> [10:59:42] Exception: E06D7363.PAVEEFileLoadException@@
> [10:59:42] Exception: E0434F4D.System.IO.FileNotFoundException
> [10:59:45] Exception: 80000003.BREAKPOINT
> [10:59:45] Exception: 80000004.SINGLE_STEP
> [10:59:45] Exception: 80000003.BREAKPOINT
> [10:59:45] Exception: 80000004.SINGLE_STEP
> [10:59:45] Exception: 80000003.BREAKPOINT
> [10:59:45] Exception: 80000003.BREAKPOINT
> [10:59:45] Exception: 80000004.SINGLE_STEP
> [10:59:45] Exception: 80000003.BREAKPOINT
> [10:59:45] Exception: 80000004.SINGLE_STEP
> [10:59:45] Exception: 80000003.BREAKPOINT
> [10:59:45] Exception: 80000003.BREAKPOINT
> [10:59:47] Exception: 000006D9
> [10:59:47] Exception: 000006D9
> [10:59:48] Exception: C0000005.ACCESS_VIOLATION
> The process has exited.
>
> --
> 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()
> ...

Read more...

Revision history for this message
Mun Wai Chan (munwai) wrote :

Hi Simone,

Can you advise me the command to run?

Thanks,

Mun Wai

Revision history for this message
Simone Busoli (simone.busoli) wrote :

You should have it already with the command you launched, see my quote
below:

On Fri, Oct 12, 2012 at 5:00 AM, Mun Wai Chan
<email address hidden>wrote:

> Dump file: e:\New folder (3)\nunit-x86.dmp

Revision history for this message
Mun Wai Chan (munwai) wrote :

Here you go.

Revision history for this message
Simone Busoli (simone.busoli) wrote :
Download full text (3.2 KiB)

Hi Mun,

not enough I'm afraid as it looks like a minidump rather than a full dump.
In any case I doubt it will be useful, I did a bit of research and I'm not
sure analyzing it will give us any clue of what's going on. I believe the
very best thing we could do is experiment, but it takes time especially as
we don't have access to that code and cannot reproduce the problem.

In any case one somewhat simple thing you could do is compile nunit for
.net 4.0 and try to run your tests with it, after you compile them and your
production code for .net 4.0 too. Since these kind of exceptions might be
related to the CLR itself (although quite unlikely) it might be something
which in CLR 4 went away.
To compile NUnit for 4.0 pull the code from launchpad with a bazaar client
and just run build net-4.0 in the root folder.

Simone

On Fri, Oct 12, 2012 at 11:52 AM, Mun Wai Chan
<email address hidden>wrote:

> Here you go.
>
> ** Attachment added: "nunit-console-x86_121012_105550.dmp"
>
> https://bugs.launchpad.net/nunitv2/+bug/1064804/+attachment/3396099/+files/nunit-console-x86_121012_105550.dmp
>
> --
> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~nunit-core
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~nunit-core
> More h...

Read more...

Revision history for this message
Mun Wai Chan (munwai) wrote :

Hi Simone,

I did a checkout of the NUnit source code using "bzr branch lp:nunitv2".

I then changed all the projects in the solution to .Net 4 (target framework) and nunit-console.exe project to x86. I also recompiled my test to use .Net 4. I then ran the tests and the console still crashes.

E:\New folder (3)\ClassLibrary1\bin\Debug>"e:\NUnit Source Code\nunitv2\bin\Debu
g\nunit-console.exe" ClassLibrary1.dll
NUnit-Console version 2.6.2.0
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
   OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
  CLR Version: 4.0.30319.17929 ( Net 4.0 )

ProcessModel: Default DomainUsage: Single
Execution Runtime: net-4.0
.

Revision history for this message
Simone Busoli (simone.busoli) wrote :
Download full text (3.3 KiB)

Hi, what you did won't give you the expected results. Please follow these
steps:

   1. bzr branch lp:nunitv2
   2. open a console and "cd" into the root folder
   3. run ".\build.bat net-4.0" from the command line
   4. run your tests with ".\builds\net\4.0\debug\nunit-console-x86.exe"

Simone

On Mon, Oct 15, 2012 at 9:12 AM, Mun Wai Chan
<email address hidden>wrote:

> Hi Simone,
>
> I did a checkout of the NUnit source code using "bzr branch lp:nunitv2".
>
> I then changed all the projects in the solution to .Net 4 (target
> framework) and nunit-console.exe project to x86. I also recompiled my
> test to use .Net 4. I then ran the tests and the console still crashes.
>
>
> E:\New folder (3)\ClassLibrary1\bin\Debug>"e:\NUnit Source
> Code\nunitv2\bin\Debu
> g\nunit-console.exe" ClassLibrary1.dll
> NUnit-Console version 2.6.2.0
> Copyright (C) 2002-2012 Charlie Poole.
> Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A.
> Vorontsov.
> Copyright (C) 2000-2002 Philip Craig.
> All Rights Reserved.
>
> Runtime Environment -
> OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
> CLR Version: 4.0.30319.17929 ( Net 4.0 )
>
> ProcessModel: Default DomainUsage: Single
> Execution Runtime: net-4.0
> .
>
> --
> 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
>
> _______________________________________________
> Mailing li...

Read more...

Revision history for this message
Mun Wai Chan (munwai) wrote :

Hi,

I did as above and it is still crashing.

            BUILD SUCCEEDED

            Total time: 0.3 seconds.

     [copy] Copying 1 file to 'E:\TEST\nunitv2\builds\net\4.0\debug\NUnitTests.n
unit'.
     [copy] Copying 2 files to 'E:\TEST\nunitv2\builds\net\4.0\debug'.

BUILD SUCCEEDED

Total time: 18.5 seconds.

E:\TEST\nunitv2>builds\net\4.0\debug\nunit-console-x86.exe "e:\New folder (3)\Cl
assLibrary1\bin\Debug\ClassLibrary1.dll"
NUnit-Console version 2.6.2.12289
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
   OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
  CLR Version: 4.0.30319.17929 ( Net 4.0 )

ProcessModel: Default DomainUsage: Single
Execution Runtime: net-4.0
.

The exception from the event logs:

Application: nunit-console-x86.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 5785CA87 (57840000) with exit code 80131506.

affects: nunitv2 → nunit-3.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.