Nunit 3.10 stacktrace is not as detailed as 3.9 - nunit

I'm using Nunit with Selenium C# and noticed the upgrade of Nunit to 3.10 has changed the stacktrace output. An example is...
3.9.0
at OpenQA.Selenium.Support.UI.DefaultWait`1.ThrowTimeoutException(String
exceptionMessage, Exception lastException)
at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
at ObservatoryAutomationFramework.SeleniumGetMethods.WaitForElementClickable(IWebDriver driver, IWebElement element, Int32 timeoutInSeconds, String frame, String frameType, String frameNumber) in C:\...\ActionMethods\SeleniumGetMethods.cs:line 441
at ObservatoryAutomationTests.UserScenarios_17.Test_17_ContractV2() in C:\...\Scenario17.cs:line 108
--NoSuchElementException
at SeleniumExtras.PageObjects.DefaultElementLocator.LocateElement(IEnumerable`1 bys)
at SeleniumExtras.PageObjects.WebElementProxy.get_Element()
at SeleniumExtras.PageObjects.WebElementProxy.Invoke(IMessage msg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at OpenQA.Selenium.IWebElement.get_Displayed()
at SeleniumExtras.WaitHelpers.ExpectedConditions.<>c__DisplayClass20_0.b__0(IWebDriver driver)
at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
--TearDown
at NUnit.Framework.Assert.ReportFailure(String message)
at NUnit.Framework.Assert.Fail(String message, Object[] args)
at NUnit.Framework.Assert.Fail(String message)
at ObservatoryAutomationTests.UserScenarios_17.TestTeardown() in C:\...\Scenario17.cs:line 201
3.10.0
at ObservatoryAutomationTests.UserScenarios_17.TestTeardown() in C:\...\Scenario17.cs:line 201
--TearDown
at NUnit.Framework.Assert.ReportFailure(String message) in C:\src\nunit\nunit\src\NUnitFramework\framework\Assert.cs:line 408
at NUnit.Framework.Assert.Fail(String message, Object[] args) in C:\src\nunit\nunit\src\NUnitFramework\framework\Assert.cs:line 155
at NUnit.Framework.Assert.Fail(String message) in C:\src\nunit\nunit\src\NUnitFramework\framework\Assert.cs:line 165
at ObservatoryAutomationTests.UserScenarios_17.TestTeardown() in C:\...\Scenario17.cs:line 201
Is there some kind of command to get the same level of output I had in 3.9 without downgrading back to 3.9?

The two stack traces differ because the first shows two errors, the second only one.
The first trace indicates that an error occured in your test followed by another in your teardown. The second only shows a teardown error occuring at the point in time where NUnit is attempting to report a failure.
Whatever you are doing in teardown to cause the error (you could post code here for advice) should be fixed first. It's hard to figure out what's wrong if NUnit is not able to report the error.

Related

Visual Studio Test task fails randomly without error message, Exit code 1 returned from process: node.exe

We have this issue that has been plaguing our engineering group for over a year and we cannot make any progress on the resolution. This question on Stack Overflow is eerily similar to what we experience.
We have several pipelines that use the "Visual Studio Test" task to run a set of NUnit tests from a single assembly. There are 1400-1500 unit tests in the project and it takes The NUnit Test Adapter is deployed via the NuGet task (install NUnit3TestAdapter). This test assembly is built with the following settings:
MSBuild Architecture=x86
Platform=AnyCPU
Configuration=Release
Strong Name Signed
Across multiple pipelines, this step randomly yet consistently ends early with zero error message or trace of why the process ended. Running a subsequent build of the pull request will often result in a success but occasionally another failure. In this case we have coined this a "flaky build" where given the same exact code inputs, the build can fail and then subsequently pass.
This is the only error message we received from the pipeline:
##[error]Exit code 1 returned from process: file name 'REDACTED\externals\node\bin\node.exe', arguments '"REDACTED_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.170.1\runvstest.js"'.
Finishing: Integration Tests
These tests are our "integration tests" that perform many setup steps to create a functional version of our system including creating a web server via Kestrel to host our API, connect to (localdb) running on the build server to restore a database .bak file and apply a database project (dacpac) as well as connect to Redis (also installed locally on the build server).
We are struggling to determine next steps so I am reaching out to the community to see if anyone else has suffered through this issue, has ideas for how to debug the issue or perhaps even a solution!
edit on 2020-11-10
Yesterday I set the pipeline variable system.debug to true and this is the output it captured during one of our flaky builds.
##[error\]Exit code 1 returned from process: file name 'E:\\servername\\externals\\node\\bin\\node.exe', arguments '"E:\\servername\\\_work\\\_tasks\\VSTest\_ef087383-ee5e-42c7-9a53-ab56c98420f9\\2.170.1\\runvstest.js"'.
##[debug\]Microsoft.VisualStudio.Services.Agent.Util.ProcessExitCodeException: Exit code 1 returned from process: file name 'E:\\servername\\externals\\node\\bin\\node.exe', arguments '"E:\\servername\\\_work\\\_tasks\\VSTest\_ef087383-ee5e-42c7-9a53-ab56c98420f9\\2.170.1\\runvstest.js"'.
at Microsoft.VisualStudio.Services.Agent.Util.ProcessInvoker.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary\`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue\`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.ProcessInvokerWrapper.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary\`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue\`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.DefaultStepHost.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary\`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Boolean inheritConsoleHandler, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.NodeHandler.RunAsync()
at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.RunAsync()
at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)

Azure Functions v3, Dotnet Core v3.1 EF core /EF Core SQL 3.1.x No Errors no Data from SQL in Kubernetes

using this image mcr.microsoft.com/azure-functions/dotnet:3.0. Running on baremetal kubernetes or local docker I get no errors but also no data from SQL Server. I am using the RabbitMq trigger to start the function on received message. The function is async and I use FunctionsStart in my startup.cs. I have confirmed the environment variable is set and correct at runtime. The context is not used directly in the function but is use by another IService that I inject.
Note - The code runs just fine in the debug emulator, connection and data return without issues. Also runs just fine with I remove EF and the MyDbContext.
builder.Services
.AddDbContext<MyDbContext>(options =>
options.UseSqlServer(Environment.GetEnvironmentVariable("MY_DB")))
Note sure if this warning is related to the issue.
warn: Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService[0]
Breaking change analysis operation failed
System.NotSupportedException: The invoked member is not supported in a dynamic assembly.
at System.Reflection.Emit.InternalAssemblyBuilder.get_CodeBase()
at Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService.LogBreakingChangeReport(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/BreakingChangeAnalysis/ChangeAnalysisService.cs:line 140
at Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService.TryLogBreakingChangeReportAsync(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/BreakingChangeAnalysis/ChangeAnalysisService.cs:line 103
[14:39:30 WRN] Breaking change analysis operation failed
System.NotSupportedException: The invoked member is not supported in a dynamic assembly.
at System.Reflection.Emit.InternalAssemblyBuilder.get_CodeBase()
at Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService.LogBreakingChangeReport(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/BreakingChangeAnalysis/ChangeAnalysisService.cs:line 140
at Microsoft.Azure.WebJobs.Script.ChangeAnalysis.ChangeAnalysisService.TryLogBreakingChangeReportAsync(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/BreakingChangeAnalysis/ChangeAnalysisService.cs:line 103

MongoDB and Multiple C# Client Threads

I have a single primary instance of a MongoDB to connect to. I am using the C# driver (latest revision) to connect and utilise MongoDB.
My client application is multi-threaded whereby processes will run periodically at different intervals to produce reports. When more than one thread is running, and I call various functions on the driver (e.g server.DatabaseExists(...)), I am consistently met with an exception.
"The requested name is valid, but no data of the requested type was found"
at System.Net.Dns.GetAddrInfo(String name)
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
at MongoDB.Driver.MongoServerAddress.ToIPEndPoint(AddressFamily addressFamily) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoServerAddress.cs:line 195
at MongoDB.Driver.MongoServerInstance.GetIPEndPoint() in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoServerInstance.cs:line 339
at MongoDB.Driver.Internal.MongoConnection.Open() in C:\work\rstam\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 368
at MongoDB.Driver.Internal.MongoConnection.GetNetworkStream() in C:\work\rstam\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 574
at MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage message, SafeMode safeMode, String databaseName) in C:\work\rstam\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 555
at MongoDB.Driver.MongoCursorEnumerator`1.GetReply(MongoConnection connection, MongoRequestMessage message) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 295
at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst() in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 253
at MongoDB.Driver.MongoCursorEnumerator`1.MoveNext() in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 141
at MongoDB.Driver.MongoDatabase.GetCollectionNames() in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoDatabase.cs:line 645
at MongoDB.Driver.MongoDatabase.CollectionExists(String collectionName) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoDatabase.cs:line 297
Running one thread does not cause this issue. I am of the understanding that MongoDB is thread-safe, so I am at loss to understand the cause and the remedy.
The only "solution" I've found was to recycle the Application Pool that's hosting my website\service calling the mongo client.

Error publishing an asp 3.5 app

Well, I'm here to ask about some problem I have, the detail is that when I publish the application from my computer to the server folder and after make the changes in IIS when I try to browse the web app I get the next error:
Index and length must refer to a location within the string.
Parameter name: length
In my local computer, I installed Visual Studio 2008 with SP1 and in the server is not installed only Framework 3.5.
Is the error related with Entity Framework or it's another problem?
Well, I hope you could help me... regards !
Stack Trace:
[ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length]
System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +7495179
System.String.Substring(Int32 startIndex, Int32 length) +11
InnovaWebSite.Global.Session_Start(Object sender, EventArgs e) in C:\Users\cvelazquezt\Desktop\InnovaWeb\InnovaWebSite\Global.asax.cs:117
System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e) +8783312
System.Web.SessionState.SessionStateModule.CompleteAcquireState() +237
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +504
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +66
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
The error thrown is from a substring operation. Where it is actually being thrown, I have no clue, as you have not actually posted the stack trace on the error. This could be because you don't know how to do this?
If you can find the stack trace, or even detail your code that gets pieces of a string, you will have a better context of the exception and be able to start doing something to cure it.
As for root cause, the fact it is only happening after publish indicates a) something is missing on the server or b) the server is configured incorrectly (wrong version of .NET for the app pool for example) or c) you have not correctly published the site (maybe copied from your compiled application rather than published and moved the published version over, etc.???)

Random COMException on Web App "The handle is invalid"

All of a sudden, I am consistently getting a weird COMException on this machine when I try serve a web app with IIS. I never used to have any problems with this.
Stack Trace:
[COMException (0x80070006): The handle is invalid. (0x80070006 (E_HANDLE))]
[FileLoadException]
System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +0
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
How can I fix this? I need this server to be working later today for a demo.
Things I have tried:
Stop/Start in IIS
aspnet_regiis -i
reboot
It is not actually a COM error, it is a Windows error, wrapped in a COM error code. It is a very low-level error, little can be distilled from the error code or the stack trace. There are plenty of hits when you Google the message, here's one that looks good. Be sure to find more yourself if that's not a good match.