Re: UTF8 exception in Nunit 2.4.8
"Charlie Poole" <[email protected]> Thu, 24 Jul 2008 22:34:35 -0700
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <000a01c8ee18$2182b8a0$6401a8c0@ferrari> |
In the very last lie of your stack trace, we can see that NUnit is in the constructor of it's ContextHolder class. The ContextHolder is trying to save the value of Console.Out so it can be restored later. An exception is being thrown, within the .NET code. Have any of your tests run before this point? That would seem to be the only way that the value of Console.Out could get messed up. Also, what's your environment? Charlie > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf > Of William Garrison > Sent: Thursday, July 24, 2008 7:23 PM > To: [email protected] > Subject: [Nunit-users] UTF8 exception in Nunit 2.4.8 > > 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\Te > stContext.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=/ > _______________________________________________ > Nunit-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nunit-users > ------------------------------------------------------------------------- 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=/