UTF8 exception in Nunit 2.4.8
William Garrison <[email protected]> Thu, 24 Jul 2008 22:23:21 -0400
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <[email protected]> |
I am trying to run NUnit GUI 2.4.8 on a DLL that I created and I get:
System.ArgumentException: Message="The UTF8 string passed in could
not be converted to Unicode."
at System.RuntimeMethodHandle.GetName()
at System.Reflection.RuntimeMethodInfo.get_Name()
at System.Diagnostics.StackTrace.ToString(TraceFormat traceFormat)
at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.IO.StreamWriter.Init(Stream stream, Encoding encoding,
Int32 bufferSize)
at System.IO.StreamWriter..ctor(Stream stream, Encoding encoding,
Int32 bufferSize)
at System.IO.StreamWriter..ctor(Stream stream, Encoding encoding,
Int32 bufferSize, Boolean closeable)
at System.Console.InitializeStdOutError(Boolean stdout)
at System.Console.get_Out()
at NUnit.Core.TestContext.ContextHolder..ctor() in
C:\svn\Scratch\wgarrison\NUnit-2.4.8-src\src\NUnitCore\core\TestContext.cs:line
190
I traced into the code far enough to know it has something to do with
the redirection of Console.Out. But I'm not clear on how that works or
what is going wrong.
I traced into the code, and here is what happens:
1) Set a breakpoint at line 147 of ProxyTestRunner.cs. This line is:
this.testRunner.BeginRun( listener, filter );
At this point, the value of Console.Out is valid. I know that seems
irrelevent, but keep reading. I then step into that call.
2) I am now at line 74 of RemoteTestRunner.cs. That is the first line of:
public override void BeginRun( EventListener listener, ITestFilter filter )
At this point, the value of Console.Out results in the
System.ArgumentException. I do not understand why Console.Out was
destroyed at this point.
3) Now, run for a bit until line 190 of TestContext.cs. That line is:
this.outWriter = Console.Out;
This is the first reference to Console.Out since it was destroyed. This
causes the exception. It was a real bear to track down too, because the
debugger doesn't properly stop on exceptions that are thrown from inside
static constructors. I had to turn on native code debugging in Visual
Studio to even see it
I don't understand what Nunit is doing with Console.Out. I assume it is
somehow redirecting it, and that is not working. But never in this
process do I hit any line that does Console.SetOut, so I don't see how
that is it. Can someone explain how it is doing this? Or what about it
is causing this crazy UTF8 exception?
Lastly -- should I post this on the developer mailing list?
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/