VerifyTests / Verify.Bunit

MIT License
0 stars 0 forks source link

updating past release 6.4.0, lose AddTestAuthorization & System.MissingFieldException: Field not found: 'Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame.FrameType'. #29

Open NTC-THSTO opened 3 days ago

NTC-THSTO commented 3 days ago

using Bunit

Trying to update the project to .net 8

Finding that with latest release:

    <PackageReference Include="Verify.Bunit" Version="11.0.0" />

makes our tests reference unresolvable:

    ctx.Services.AddTestAuthorization(); // Cannot resolve symbol 'AddTestAuthorization'

trial and error shows that we lose that reference between 6.4.0 & 6.5.0.

Using 6.4.0 we get:

System.MissingFieldException: Field not found: 'Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame.FrameType'.

System.MissingFieldException
Field not found: 'Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame.FrameType'.
   at Bunit.Rendering.TestRenderer.GetComponent[TComponent](Int32 rootComponentId)
   at Bunit.Rendering.TestRenderer.FindComponent[TComponent](Int32 parentComponentId)
   at Bunit.Rendering.TestRenderer.RenderComponent[TComponent](IEnumerable`1 parameters)
   at Bunit.TestContext.RenderComponent[TComponent](Action`1 parameterBuilder)
   at Tdt.Web.Tests.IndexTests.Index_UnauthorisedUser_ComponentRendersCorrectly() in C:\work\repos\DCC\New folder (3) - Copy\src\TestDataTool\Web\Tdt.Web.Tests\IndexTests.cs:line 45
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

using the following versioning:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <IsPackable>false</IsPackable>
    <SonarQubeTestProject>True</SonarQubeTestProject>
  </PropertyGroup>
  <ItemGroup>
    <Compile Remove="StartupTests.cs" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="DNTCaptcha.Core" Version="3.6.0" />
    <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="8.0.8" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
    <PackageReference Include="Moq" Version="4.16.0" />
    <PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0" />
    <PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
    <PackageReference Include="Verify.Blazor" Version="11.0.0" />
    <PackageReference Include="Verify.Bunit" Version="6.4.0" />
    <PackageReference Include="xunit" Version="2.9.0" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="coverlet.collector" Version="3.0.2">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Tdt.Web\Tdt.Web.csproj" />
  </ItemGroup>
</Project>

Which I have noticed has been reported before on this github section I am no C# wizard. If this is a developer error, I apologise though any suggestions would be greatly appreciated.


SimonCropp commented 2 days ago

can share a small self contained solution that reproduces the issue