mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Can't start server in Xamarin Android #184
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 @eli-darkly on GitHub (Jun 28, 2019).
There's an issue with Xamarin Android's support for ASP.NET Core that currently makes WireMock.Net unusable. I don't think there is currently a workaround, but I think that would be easy to change.
Trying to create a FluentMockServer causes this exception:
Here's the issue. If you use
WebHostBuilderand you don't specify aContextRootPathin the host builder options,WebHostBuildertries to create a path fromAppContext.BaseDirectory. In Xamarin Android, for whatever reason, there is a known issue where that property is null.Currently, there is no way to make WireMock set the
ContextRootPath. And I don't think that property is actually serving any purpose in this case (since if you're using the filesystem handler, the path is specified by a different mechanism)— but without it, things definitely won't work in Android. I have a solution in mind and I'll submit a PR.