cs7003 unexpected use of an unbound generic name

I had the same message. I moved the @model at first line and the error gone.


I made a mistake that took me quite a while to see. I created a generic method:

public static T MyMethod<T>() { ... }

By mistake, I wrote in my code

var something = MyMethod<>();

It compiled but at runtime it threw the error "unexpected use of an unbound generic name".

If ever you made the same mistake, you might try to search "<>" in your code...


Just cut the line @model and save, then paste it again and save, it should be gone.


It took shutting down Visual Studio and restarting for the error to clear. Subsequent rebuilds do not produce the error.