mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Why is IRequestMessage.BodyAsMimeMessage null in new versions (> 1.8.7) #698
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 @jheier on GitHub (Jun 13, 2025).
Originally assigned to: @StefH on GitHub.
We are using IRequestMessage.BodyAsMimeMessage to do some extra processing when Mocking a request containing a Mime-message. All things are working as expected when using WireMock.Net 1.8.7. In the versions > 1.8.7 our code is broken; the value is null.
Looking a the WireMock-code we think that TypeLoader cannot find the needed DLL when using TypeLoader.TryFindTypeInDlls. The implementation uses Directory.GetCurrentDirectory() but that could be another directory than the folder containing the DLL's.
Question: Is this an extra restriction in the new versions? It should be added to the documentation.
@StefH commented on GitHub (Jun 13, 2025):
Can you post your complete code please?
Because this code works when using 1.8.11:
Output =
@jheier commented on GitHub (Jun 14, 2025):
Also, is after WireMock.Net 1.8.8 is the MimeKitLite Wiki still relevant?
@StefH commented on GitHub (Jun 14, 2025):
https://github.com/wiremock/WireMock.Net/pull/1320
@StefH commented on GitHub (Jun 14, 2025):
@jheier
There are indeed some changes related to MimeKitLite, and I have to check the wiki.
However in PR https://github.com/wiremock/WireMock.Net/pull/1320
I did create a new console-app and unit test which uses the latest NuGet, and both run fine.
Could it be that you mimemessage is not correctly detected anymore as a mimemessage?
What header do you use?
And which .NET version do you use?
Can you maybe post your complete test ?
@StefH commented on GitHub (Jun 14, 2025):
@jheier
Sorry, now I see the
Directory.SetCurrentDirectory(@"C:\Windows");indeed breaks the code, I'll fix it.@StefH commented on GitHub (Jun 14, 2025):
@jheier
can you test 1.8.11-fix-05-ci-110201 ?
(https://github.com/wiremock/WireMock.Net/wiki/MyGet-preview-versions)
@jheier commented on GitHub (Jun 15, 2025):
Indeed this fixes the problem.