mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
ReflectionTypeLoadException occurs when running multiple unit tests (Nunit 3) #704
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @R-Lamberson on GitHub (Jul 10, 2025).
Originally assigned to: @StefH on GitHub.
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
when I run the tests individually I don't receive this error
I found the assembly within the WireMock.net packages and it appears that the 'HandlebarsDotNet.Helpers.XsltHelpers' does not have an implementation
Expected behavior:
All tests run without generating an exception
Test to reproduce
@StefH commented on GitHub (Jul 10, 2025):
@R-Lamberson commented on GitHub (Jul 10, 2025):
Sorry should have included that, version 1.8.13 of WireMock.net, and confirmed that I do not have a manually imported reference to HandleBars.Net
@StefH commented on GitHub (Jul 10, 2025):
Can you clean your solution / delete all bin and obj folders.
Also delete all handlebars related nuget folders from your nuget cache folder.
Restore all packages.
Rebuild and test again.
@R-Lamberson commented on GitHub (Jul 11, 2025):
I just did those steps and I end up with the same behavior.
@StefH commented on GitHub (Jul 12, 2025):
Do you still get error like:
'HandlebarsDotNet.Helpers.Xslt, Version=2.4.6.0 ?
@R-Lamberson commented on GitHub (Jul 18, 2025):
Yes
@StefH commented on GitHub (Jul 18, 2025):
https://github.com/wiremock/WireMock.Net/pull/1332
@StefH commented on GitHub (Jul 18, 2025):
I found the issue.
New version will be released tomorrow.
@R-Lamberson commented on GitHub (Jul 18, 2025):
I updated to version Wiremock.net 1.8.15, purged my bin and obj directories, cleaned my project and reran my tests and still hit the same behavior
test explorer error when running batch tests

nuget manager showing version upgrade, and class view showing the Handlebars.DotNet.Helpers.Xslt class view without exposed classes

@StefH commented on GitHub (Jul 18, 2025):
Please wait until next version tomorrow.
https://github.com/wiremock/WireMock.Net/blob/master/CHANGELOG.md
@R-Lamberson commented on GitHub (Jul 21, 2025):
Confirmed no longer getting an error from Handlebar Dotnet Helpers XSLT