[nant-dev] [ nant-Bugs-1325875 ] TargetInvocationException using NUnit2 task

2005-10-13 Thread SourceForge.net
Bugs item #1325875, was opened at 2005-10-13 14:27
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=402868aid=1325875group_id=31650

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tasks
Group: 0.85
Status: Open
Resolution: None
Priority: 5
Submitted By: Peter McEvoy (pmcevoy)
Assigned to: Nobody/Anonymous (nobody)
Summary: TargetInvocationException using NUnit2 task

Initial Comment:
Hi Everyone,
Windows 2000, .Net 1.1, nant-0.85-nightly-2005-10-11,
nunit2.2

I'm getting a TargetInvocationException when using nant
to run NUnit2 tasks against assemblies that contain J#
code.

I believe that the cause is due to
http://support.microsoft.com/?kbid=830297 in that when
an appdomain with J# code is unloaded, stdout gets
closed, which Nant then tries to write log messages to.  

I have attached a simple solution that demonstrates the
problem when executed with the nunit2 task (build the
solution, then execute the tests using nant and the
included nant.build).  

I have also attached a fix to NUnit2TestDomain.cs
which allows nant to continue and run all tests -
although I have no doubt that the nant devs will have a
much more elegant solution than my paltry attempt ;-)

I hope that this (or better) solution can be applied to
the source tree, as I really don't want to be working
from my own personal forked version of the nant code...

Sincerely
Pete

Addendum:  I wanted to attach two files, but it does'nt
look like I can on SF...  here are the changes I made
to NUnit2TestDomain.cs:

public void Unload() {
if (_domain != null) {
try {
AppDomain.Unload(_domain);

//Due to bug
http://support.microsoft.com/?kbid=830297, any
assemblies containing
//J# code referenced in the unit test will cause
stdout to get closed when the AppDomain
//is unloaded - this code just reopens stdout and
allows nant to continue
StreamWriter standardOutput = new
StreamWriter(Console.OpenStandardOutput());

standardOutput.AutoFlush = true;
Console.SetOut(standardOutput);
} catch (CannotUnloadAppDomainException) {
// ignore exceptions during unload, this matches the 
// behaviour of the NUnit TestDomain
} finally {
_domain = null;
}
}
}


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=402868aid=1325875group_id=31650


---
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
___
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers


[nant-dev] [ nant-Bugs-1325875 ] TargetInvocationException using NUnit2 task

2005-10-13 Thread SourceForge.net
Bugs item #1325875, was opened at 2005-10-13 14:27
Message generated for change (Comment added) made by pmcevoy
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=402868aid=1325875group_id=31650

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tasks
Group: 0.85
Status: Open
Resolution: None
Priority: 5
Submitted By: Peter McEvoy (pmcevoy)
Assigned to: Nobody/Anonymous (nobody)
Summary: TargetInvocationException using NUnit2 task

Initial Comment:
Hi Everyone,
Windows 2000, .Net 1.1, nant-0.85-nightly-2005-10-11,
nunit2.2

I'm getting a TargetInvocationException when using nant
to run NUnit2 tasks against assemblies that contain J#
code.

I believe that the cause is due to
http://support.microsoft.com/?kbid=830297 in that when
an appdomain with J# code is unloaded, stdout gets
closed, which Nant then tries to write log messages to.  

I have attached a simple solution that demonstrates the
problem when executed with the nunit2 task (build the
solution, then execute the tests using nant and the
included nant.build).  

I have also attached a fix to NUnit2TestDomain.cs
which allows nant to continue and run all tests -
although I have no doubt that the nant devs will have a
much more elegant solution than my paltry attempt ;-)

I hope that this (or better) solution can be applied to
the source tree, as I really don't want to be working
from my own personal forked version of the nant code...

Sincerely
Pete

Addendum:  I wanted to attach two files, but it does'nt
look like I can on SF...  here are the changes I made
to NUnit2TestDomain.cs:

public void Unload() {
if (_domain != null) {
try {
AppDomain.Unload(_domain);

//Due to bug
http://support.microsoft.com/?kbid=830297, any
assemblies containing
//J# code referenced in the unit test will cause
stdout to get closed when the AppDomain
//is unloaded - this code just reopens stdout and
allows nant to continue
StreamWriter standardOutput = new
StreamWriter(Console.OpenStandardOutput());

standardOutput.AutoFlush = true;
Console.SetOut(standardOutput);
} catch (CannotUnloadAppDomainException) {
// ignore exceptions during unload, this matches the 
// behaviour of the NUnit TestDomain
} finally {
_domain = null;
}
}
}


--

Comment By: Peter McEvoy (pmcevoy)
Date: 2005-10-13 14:29

Message:
Logged In: YES 
user_id=36439

Ah... it seems you can add a second file via the comments...

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=402868aid=1325875group_id=31650


---
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
___
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers