mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
NullRef in 1.0.21 #188
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 @zidad on GitHub (Jul 8, 2019).
Originally assigned to: @StefH on GitHub.
Upgrading my tests to WireMock 1.0.21 starting giving me a NullReferenceException, I haven't figured out why exactly:
"ClassName":"System.NullReferenceException","Message":"Object reference not set to an instance of an object.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at WireMock.ResponseBuilders.Response.ProvideResponseAsync(RequestMessage requestMessage, IFluentMockServerSettings settings) in /ResponseBuilders/Response.cs:line 419
at WireMock.Mapping.ResponseToAsync(RequestMessage requestMessage) in /Mapping.cs:line 83
at WireMock.Owin.WireMockMiddleware.InvokeInternal(HttpContext ctx) in /Owin/WireMockMiddleware.cs:line 121","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467261,"Source":"WireMock.Net","WatsonBuckets":null}
@zidad commented on GitHub (Jul 8, 2019):
Looks like it could be related to this commit, probably the settings or filesystemhandler is null:
93682c9bbf (diff-9c7a467190fbb513b80085bfc57d18faR421)Downgrading to WireMock 1.0.20 for now solves the problem.
@StefH commented on GitHub (Jul 8, 2019):
Can you please provide your unit test example code?
@zidad commented on GitHub (Jul 8, 2019):
Something as simple as this fails with me with 1.0.21:
System.Net.Http.HttpRequestException : Response status code does not indicate success: 500 (Internal Server Error).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at System.Net.Http.HttpClient.GetStringAsyncCore(Task`1 getTask)
at xxx.FluentMockServerTest.ReproduceIssue() in xxx\MockServerTests.cs:line 43
--- End of stack trace from previous location where exception was thrown ---
In the output I find:
Failed response as json: {"ClassName":"System.NullReferenceException","Message":"Object reference not set to an instance of an object.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at WireMock.ResponseBuilders.Response.ProvideResponseAsync(RequestMessage requestMessage, IFluentMockServerSettings settings) in /ResponseBuilders/Response.cs:line 419\r\n at WireMock.Mapping.ResponseToAsync(RequestMessage requestMessage) in /Mapping.cs:line 83\r\n at WireMock.Owin.WireMockMiddleware.InvokeInternal(HttpContext ctx) in /Owin/WireMockMiddleware.cs:line 121","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467261,"Source":"WireMock.Net","WatsonBuckets":null}@StefH commented on GitHub (Jul 8, 2019):
Thanks, I'll look into this.
@StefH commented on GitHub (Jul 8, 2019):
@zidad Can you try 1.0.22 preview version from MyGet ? (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)
WireMock.Net.1.0.22-ci-11507// btw : don't use a hard-coded port in your unit-tests
@zidad commented on GitHub (Jul 15, 2019):
Hi @StefH, it works, and thanks for the tip about the ports! :)