Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StackOverflow Exception when running tests with vstest.console.exe #1227

Closed
BenSchoen opened this issue Oct 3, 2023 · 10 comments
Closed

StackOverflow Exception when running tests with vstest.console.exe #1227

BenSchoen opened this issue Oct 3, 2023 · 10 comments

Comments

@BenSchoen
Copy link

BenSchoen commented Oct 3, 2023

I have some tests using buint. The tests running in Visualstudio 2022. When running these tests with donet test or vstest.console.exe i got the exception below. I removed some test to check if a dedicated test is responsible for the error, but i had no success.

If i go back to version of bunit 1.18.4 i do not have the issue.

The active test run was aborted. Reason: Test host process crashed : Stack overflow.
at System.Text.StringBuilder.Append(Char ByRef, Int32)
at System.Text.StringBuilder.Append(System.String)
at Bunit.Htmlizer.RenderAttributes(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32, System.String ByRef) at Bunit.Htmlizer.RenderElement(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32)
at Bunit.Htmlizer.RenderChildren(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderElement(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32)
at Bunit.Htmlizer.RenderChildren(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderElement(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32)
at Bunit.Htmlizer.RenderChildComponent(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderChildComponent(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32)
at Bunit.Htmlizer.RenderChildComponent(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderChildComponent(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32)
at Bunit.Htmlizer.RenderChildComponent(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderChildren(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32)
at Bunit.Htmlizer.RenderElement(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderChildComponent(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32)
at Bunit.Htmlizer.RenderChildren(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderElement(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32)
at Bunit.Htmlizer.RenderChildComponent(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32) at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32, Int32) at Bunit.Htmlizer.RenderChildComponent(HtmlRenderingContext, System.ReadOnlySpan1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderCore(HtmlRenderingContext, System.ReadOnlySpan`1<Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame>, Int32)
at Bunit.Htmlizer.RenderFrames(HtmlRenderingCon

  • bUnit version: 1.22.9
  • .NET Runtime and Blazor version: Blazor Server v7.0.0.0 @ .NET 7.0.2
  • OS type and version: Windows 10
@linkdotnet
Copy link
Sponsor Collaborator

Hey, thanks for reporting.

by any chance do you have any code (at best minimal and reproducible) that you could show?

often times such issues arise when you call something like Click inside WaitForHelpers.

@egil
Copy link
Member

egil commented Oct 3, 2023

Hmm glancing at the stack trace, the endless loop seems to happen while generating rendered markup. As far as I know it should not be possible to have a self referring render tree.

I would really like to see the component-under-test and test case.

@BenSchoen
Copy link
Author

Hey all

Tanks for the immediate response and hints. I tried to isolate the problem but without success. It seems that there is something which influences other tests....

I will try it soon and let you know when i found something.

@BenSchoen
Copy link
Author

Hello

I am not able to extract the problem to a separate project. I have some findings:

  • Tests running with VisualStudio Test Runner even in endless run
  • Tests does not run with vstest.console.exe
  • Tests does not run with dotnet test
  • The amount of test influence the failure
  • I am not able to extract the problem in a separate project
  • It works with version 1.18.4 with all test runners

I build an example, that you can see how the setup and the test case is. I am sorry, i am not allowed to share the code here....
BunitTestProject.zip]

@egil
Copy link
Member

egil commented Oct 4, 2023

Hi @BenSchoen,

I just downloaded your sample and ran it in Visual Studio without issues. Also ran fine from dotnet test. Did you include the failing test?

@BenSchoen
Copy link
Author

No it is sadly not possible to let the test fail with the small project.... But the way i set up the test and the component is the same.

@egil
Copy link
Member

egil commented Oct 4, 2023

Can you share the full project with us (privately, through email, if needed)?

@egil
Copy link
Member

egil commented Oct 6, 2023

I think we have found the culprit. If things go as planned, we will have a preview release soon that you can test out.

@egil
Copy link
Member

egil commented Oct 6, 2023

There should be a new 1.24.x-preview release out now. Please give it a go (remember to update both your projects that reference bunit).

@BenSchoen
Copy link
Author

@egil Yes i can confirm that the problem is solved with the 1.24.x-preview

@egil egil closed this as completed Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants