IntelliTect / EssentialCSharp

This project contains the source code for the book Essential C# by Mark Michaelis (Addison-Wesley).
https://essentialcsharp.com/
MIT License
387 stars 159 forks source link

Investigate Listing 19.17: AsyncVoidReturnTest which failed in test run #28

Closed MarkMichaelis closed 5 years ago

MarkMichaelis commented 6 years ago

Listing 19.17: AsyncVoidReturnTest failed.

Test Name:  AsyncVoidReturnTest
Test FullName:  AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_17.Tests.ProgramTests.AsyncVoidReturnTest
Test Source:    C:\Dropbox\EssentialCSharp\1\SCC\src\Chapter19.Tests\Listing19.17.Tests.cs : line 21
Test Outcome:   Failed
Test Duration:  0:00:00.2601871

Result StackTrace:  
at IntelliTect.TestTools.Console.ConsoleAssert.AssertExpectation(String expectedOutput, String output, Func`3 areEquivalentOperator) in C:\Dropbox\EssentialCSharp\1\SCC\submodules\TestTools\IntelliTect.TestTools.Console\ConsoleAssert.cs:line 164
   at IntelliTect.TestTools.Console.ConsoleAssert.Execute(String givenInput, String expectedOutput, Action action, Func`3 areEquivalentOperator, Boolean replaceCRLF) in C:\Dropbox\EssentialCSharp\1\SCC\submodules\TestTools\IntelliTect.TestTools.Console\ConsoleAssert.cs:line 148
   at IntelliTect.TestTools.Console.ConsoleAssert.Expect(String expected, Action action, Func`3 comparisonOperator, Boolean replaceCRLF) in C:\Dropbox\EssentialCSharp\1\SCC\submodules\TestTools\IntelliTect.TestTools.Console\ConsoleAssert.cs:line 77
   at IntelliTect.TestTools.Console.ConsoleAssert.ExpectLike(String expected, Action action) in C:\Dropbox\EssentialCSharp\1\SCC\submodules\TestTools\IntelliTect.TestTools.Console\ConsoleAssert.cs:line 94
   at AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_17.Tests.ProgramTests.AsyncVoidReturnTest() in C:\Dropbox\EssentialCSharp\1\SCC\src\Chapter19.Tests\Listing19.17.Tests.cs:line 31
Result Message: 
Test method AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_17.Tests.ProgramTests.AsyncVoidReturnTest threw exception: 
System.Exception: expected: 4241
actual: 5541
NOTE: The expected string contains wildcard charaters: [,],?,*,#
AreEqual failed:

Expected:
-----------------------------------
Invoking Task.Run...(Thread ID: *)
Running task... (Thread ID: *)
Post notification invoked...(Thread ID: *)
Post notification invoked...(Thread ID: *)
Throwing expected exception....(Thread ID: *)
System.Exception: Expected Exception
   *(Thread ID: *)
-----------------------------------
Actual: 
-----------------------------------
Invoking Task.Run...(Thread ID: 7)
Running task... (Thread ID: 8)
Post notification invoked...(Thread ID: 7)
Throwing expected exception....(Thread ID: 7)
System.Exception: Expected Exception
   at AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_17.Program.<>c.<OnEvent>b__6_0() in C:\Dropbox\EssentialCSharp\1\SCC\src\Chapter19\Listing19.17.AsyncVoidReturn.cs:line 94
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_17.Program.<OnEvent>d__6.MoveNext() in C:\Dropbox\EssentialCSharp\1\SCC\src\Chapter19\Listing19.17.AsyncVoidReturn.cs:line 90
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_17.AsyncSynchronizationContext.Post(SendOrPostCallback callback, Object state) in C:\Dropbox\EssentialCSharp\1\SCC\src\Chapter19\Listing19.17.AsyncVoidReturn.cs:line 36
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_17.Program.Main() in C:\Dropbox\EssentialCSharp\1\SCC\src\Chapter19\Listing19.17.AsyncVoidReturn.cs:line 75 thrown as expected.(Thread ID: 7)
-----------------------------------
The expected length of 259 does not match the output length of 1821.
COsborn2 commented 5 years ago

I cant reproduce this test failure on a Windows, Linux, or OSX environment.