diff --git a/CHANGELOG.md b/CHANGELOG.md index 35eac1447..69b43ac27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to **bUnit** will be documented in this file. The project ad ### Added +- `Render(RenderFragment)` is preferred via the `OverloadResolutionAttribute`. Reported by [@ScarletKuro](https://github.com/ScarletKuro) in #1800. Fixed by [@linkdotnet](https://github.com/linkdotnet). - `FindByTestId` to `bunit.web.query` to gather elements by a given test id. By [@jimSampica](https://github.com/jimSampica) ## [2.4.2] - 2025-12-21 diff --git a/src/bunit/BunitContext.cs b/src/bunit/BunitContext.cs index 948d44b15..cb3aea4d9 100644 --- a/src/bunit/BunitContext.cs +++ b/src/bunit/BunitContext.cs @@ -1,3 +1,6 @@ +#if NET9_0_OR_GREATER +using System.Runtime.CompilerServices; +#endif using Bunit.Extensions; using Bunit.Rendering; using Microsoft.Extensions.Logging; @@ -158,9 +161,12 @@ public virtual IRenderedComponent Render(ActionThe type of component to find in the render tree. /// The render fragment to render. /// The . +#if NET9_0_OR_GREATER + [OverloadResolutionPriority(1)] +#endif public virtual IRenderedComponent Render(RenderFragment renderFragment) where TComponent : IComponent - => this.RenderInsideRenderTree(renderFragment); + => RenderInsideRenderTree(renderFragment); /// /// Renders the and returns it as a .