NullReferenceException #326

Closed
opened 2025-12-29 15:20:53 +01:00 by adam · 2 comments
Owner

Originally created by @CoderNate on GitHub (Jan 24, 2021).

Originally assigned to: @StefH on GitHub.

e8181e9d53/src/WireMock.Net/Server/WireMockServer.Admin.cs (L264)

I get a NullReferenceException here when a request fails due to mapping being null. It looks like calling proxyHelper.SendAsync returns null for a mapping if the status code was not successful. The next if statement right below this also has the same issue.

Originally created by @CoderNate on GitHub (Jan 24, 2021). Originally assigned to: @StefH on GitHub. https://github.com/WireMock-Net/WireMock.Net/blob/e8181e9d53622bc3f1faa564332f4e87a0a18314/src/WireMock.Net/Server/WireMockServer.Admin.cs#L264 I get a NullReferenceException here when a request fails due to ``mapping`` being null. It looks like calling proxyHelper.SendAsync returns null for a mapping if the status code was not successful. The next if statement right below this also has the same issue.
adam added the bug label 2025-12-29 15:20:53 +01:00
adam closed this issue 2025-12-29 15:20:53 +01:00
Author
Owner

@StefH commented on GitHub (Jan 24, 2021):

Hello @CoderNate ,

Thanks for the information.

However I think you mean that these line can fail:

 _options.Mappings.TryAdd(mapping.Guid, mapping);

// and

 _mappingToFileSaver.SaveMappingToFile(mapping);

Correct?

@StefH commented on GitHub (Jan 24, 2021): Hello @CoderNate , Thanks for the information. However I think you mean that these line can fail: ``` c# _options.Mappings.TryAdd(mapping.Guid, mapping); // and _mappingToFileSaver.SaveMappingToFile(mapping); ``` Correct?
Author
Owner

@CoderNate commented on GitHub (Jan 25, 2021):

Yes, that's right; my mistake. Thanks.
And hey cool project! Nice work!

@CoderNate commented on GitHub (Jan 25, 2021): Yes, that's right; my mistake. Thanks. And hey cool project! Nice work!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#326