Skip to content

Alter InvokeOnSpacerBeforeVisible for NET 11.0 so it uses 4 parameters - #1919

Open
vnbaaij wants to merge 3 commits into
bUnit-dev:mainfrom
vnbaaij:main
Open

Alter InvokeOnSpacerBeforeVisible for NET 11.0 so it uses 4 parameters#1919
vnbaaij wants to merge 3 commits into
bUnit-dev:mainfrom
vnbaaij:main

Conversation

@vnbaaij

@vnbaaij vnbaaij commented Sep 9, 2026

Copy link
Copy Markdown

Alter InvokeOnSpacerBeforeVisible for NET 11.0 so it uses 4 parameters instead of 3 for invocation.

Fix #1915 (I hope 😊)

I am unfamiliar with how this change should be tested.

Pull request description

PR meta checklist

  • Pull request is targeted at main branch for code
    or targeted at stable branch for documentation that is live on bunit.dev.
  • Pull request is linked to all related issues, if any.
  • I have read the CONTRIBUTING.md document.

Code PR specific checklist

  • My code follows the code style of this project and AspNetCore coding guidelines.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I have updated the appropriate sub section in the CHANGELOG.md.
  • I have added, updated or removed tests to according to my changes.
    • All tests passed.

Copilot AI lite review requested due to automatic review settings September 9, 2026 15:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new fourth argument is currently a magic number, and it should be named/documented to make the intent and future maintenance safer.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates bUnit’s Virtualize JS interop invocation handler to match the updated VirtualizeJsInterop.OnSpacerBeforeVisible method signature on .NET 11+, addressing the exception reported in issue #1915 when rendering components that use Virtualize.

Changes:

  • Adds a 4th argument to the OnSpacerBeforeVisible invocation for NET11_0_OR_GREATER.
  • Reorders using directives to keep framework namespaces after System.*.
File summaries
File Description
src/bunit/JSInterop/InvocationHandlers/Implementation/VirtualizeJSRuntimeInvocationHandler.cs Passes the additional .NET 11+ reason parameter when invoking OnSpacerBeforeVisible via reflection.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@egil

egil commented Sep 9, 2026

Copy link
Copy Markdown
Member

@vnbaaij looks like CI doesn't work because we do not have dotnet 11 rc1 in our workflow files?

@linkdotnet

Copy link
Copy Markdown
Collaborator

@vnbaaij looks like CI doesn't work because we do not have dotnet 11 rc1 in our workflow files?

Nope - they are there (in the logs you'll find 11.0.rc-1). xUnit and the newer MTP have a problem. Guess we have to wait that out

@vnbaaij

vnbaaij commented Sep 9, 2026

Copy link
Copy Markdown
Author

Nope - they are there (in the logs you'll find 11.0.rc-1). xUnit and the newer MTP have a problem. Guess we have to wait that out

Yeah, we had an issue with the Fluent UI Blazor projects as well with xUnit and MTP v2. But I eventually managed to get everything moved over and 'ditch' VSTest. You can check out our repo to see how I did it.

@linkdotnet

Copy link
Copy Markdown
Collaborator

Nope - they are there (in the logs you'll find 11.0.rc-1). xUnit and the newer MTP have a problem. Guess we have to wait that out

Yeah, we had an issue with the Fluent UI Blazor projects as well with xUnit and MTP v2. But I eventually managed to get everything moved over and 'ditch' VSTest. You can check out our repo to see how I did it.

We did as well some weeks ago and moved to v4 of xunit.v3 (slighty confusign :D) so we should have MTP v2 as default as far as I understand.

It seems that rc.1 is making trouble with 4.0.0. That is just an educated guess here

@linkdotnet

Copy link
Copy Markdown
Collaborator

Interestingly enough - "it works on my machine" with rc.1

@vnbaaij

vnbaaij commented Sep 9, 2026

Copy link
Copy Markdown
Author

I'm using xunit.v3.mtp-v2 Version 4.0.0 (how is that for a version in disaster 😂) and was able to run all tests (with exception of the virtualize tests, of course) with our GH Action and locally as well

@linkdotnet

Copy link
Copy Markdown
Collaborator

I'm using xunit.v3.mtp-v2 Version 4.0.0 (how is that for a version in disaster 😂) and was able to run all tests (with exception of the virtualize tests, of course) with our GH Action and locally as well

Uhhhhh - feel free to add this package to our Directory.Packages.props then.
We can still drop the commit if the CI is not happy.

Not sure what is really going on tbh. It works without issue on my MBP.

- Upgrade to net11.0 RC1
- Use UserScroll as 4th parameter
- Fix compiler warnings which poped up after upgrading to net11.0 RC1
@vnbaaij

vnbaaij commented Sep 9, 2026

Copy link
Copy Markdown
Author

With my last changes I can run dotnet test locally (on Windows) without errors on both .net10.0 and .net11.0

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

Successfully merging this pull request may close these issues.

Virtualize test error with .NET 11 RC1

4 participants