Skip to content

ReflectionTypeLoadException occurs when running multiple unit tests (Nunit 3) #1328

@R-Lamberson

Description

@R-Lamberson

Describe the bug

I am getting the following error during the startup configuration of my tests when I run multiple tests with VS2022 Test Explorer. The overall application is running dotnet 8.0

System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types.
Method 'get_Category' in type 'HandlebarsDotNet.Helpers.XsltHelpers' from assembly 'HandlebarsDotNet.Helpers.Xslt, Version=2.4.6.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc' does not have an implementation.
----> System.TypeLoadException : Method 'get_Category' in type 'HandlebarsDotNet.Helpers.XsltHelpers' from assembly 'HandlebarsDotNet.Helpers.Xslt, Version=2.4.6.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc' does not have an implementation.

The stack strack points back to an internal line of code which uses Reflection to GetTypes() which appears to be triggering this exception

Image

when I run the tests individually I don't receive this error

Image

I found the assembly within the WireMock.net packages and it appears that the 'HandlebarsDotNet.Helpers.XsltHelpers' does not have an implementation

Image

Expected behavior:

All tests run without generating an exception

Test to reproduce

  • 1 use Reflection GetTypes to retrieve assembly information during the startup of the application

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions