Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stub implementations not created with pre-paren attribute whitespace #73

Closed
patridge opened this issue Nov 21, 2014 · 4 comments · Fixed by #74
Closed

Stub implementations not created with pre-paren attribute whitespace #73

patridge opened this issue Nov 21, 2014 · 4 comments · Fixed by #74
Labels

Comments

@patridge
Copy link

I haven't nailed down exactly what caused this (updating Refit to 2.1.0, updating Xamarin Studio, putting more air in my car's tires for cold weather, who knows?), but somewhere along the line the API in my Xamarin.Android app stopped getting a stubbed out version in RefitStubs.cs when I built the project. The symptom was triggering the well-worded exception from v2.1.0 telling me my interface didn't "look like a Refit interface". After lots of digging/reverting/cursing, here's the resulting difference.

Working

[Get("/users/{user}")]
Task<User> GetUser(string user);

Not so much with the working

[Get ("/users/{user}")]
Task<User> GetUser(string user);

In case you missed it, the only difference is the space between the Get and the open parenthesis
([Get ( vs. [Get().

Two methods

Oddly, if there are two methods, one with a space and one without the space (order doesn't matter), it generates the stub just fine. If all the methods have the space (tested to three), nothing is generated.

Setup (since this could be outside Refit's control)

  • OS X 10.10.1
  • Xamarin Studio 5.5.3
  • Xamarin.Android 4.18.1
@bennor
Copy link
Contributor

bennor commented Nov 21, 2014

Thanks for reporting this. I'll sort it out over the weekend (if not before).

@bennor
Copy link
Contributor

bennor commented Nov 21, 2014

So yeah... maybe a touch earlier than the weekend :bowtie:

@bennor
Copy link
Contributor

bennor commented Nov 21, 2014

@patridge In your two methods example, it should have generated a slightly different stub for the one with a space -- one that goes 💥

If it didn't do that, can you show us the content of RefitStubs.cs for the two method example?

@anaisbetts
Copy link
Member

Thanks for the great write-up @patridge - since we parse the C# at the syntax level (i.e. one of the earliest passes the compiler takes at your code, before references or project context), bugs like this are entirely possible

@lock lock bot added the outdated label Jun 25, 2019
@lock lock bot locked and limited conversation to collaborators Jun 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants