I've been getting a new build-breaking exception thrown when I try to initialize my refit interface class when, to my knowledge, I haven't changed the initialization code at all.
Note: I did recently apply nuget/xamarin updates and changed from VS Community 2015 to Community 2017.
Message = "The type initializer for 'MyApp.Services.ApiConnect' threw an exception."
Inner exception message = "URL path must be of the form '/foo/bar/baz'"
`
class ApiConnect
{
private static IMyService serviceInstance = null;
static ApiConnect()
{
serviceInstance = RestService.For<IMyService>("http://mywebapi.azurewebsites.net/");}
}
`
Any help would be appreciated.
That usually means one of your Refit API interfaces has the wrong format for its URL. (A common mistake for me is forgetting the leading slash.)
e.g.
[Get("foo/bar")] // This will throw the above exception
Task SomeEndpoint();
Make sure all of your Refit interfaces have a URL with the correct format.
That was exactly it @bennor! Thanks!
Most helpful comment
That usually means one of your Refit API interfaces has the wrong format for its URL. (A common mistake for me is forgetting the leading slash.)
e.g.
Make sure all of your Refit interfaces have a URL with the correct format.