-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Update Razor compiler to use global:: more liberally #18757
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
Comments
Thanks for the issue report @MichelArendt. This looks like a bug in Razor's code generation. Unfortunately there isn't a very good workaround for this outside of using a different member name. A fix for this would be to globally qualify the
|
@pranavkm I can make a doc issue of this and add |
@Rick-Anderson this is not a reserved keyword though. Presumably once we fix the underlying issue, this should work. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Same old thing? |
@pranavkm the problem with this issue is that there is no workaround other than changing the offending type declaration to object or dynamic. It's not possible to simply rename a type I might not own or refactor an entire application changing the namespace whenever there's a conflict. Whilst it's a rare issue, when it occurs it is a showstopper. Any chance this can be pulled out of the backlog and shipped as part of .NET 5? |
@diegofrata at this point we're close to wrapping up changes for 5.0. I'll have a look to see how trivial this change is, but I suspect it's fairly involved would make it more likely this would only be fixed in the next major release. |
Issue: In a Razor Component any variables named "Microsoft" reproduce the error (variable type on the error message changes accordingly):
Question: Is this an issue or by design?
Project details and files: This is a Razor Class Library project.
.csproj
LoginFormUserComponent.razor
Comments:
I started getting this random error and found out that apparently I cannot write "Microsoft" as a variable name in a Razor component.
I was unable to find the search keywords for anything similar to this.
I initially thought that there was a reference issue on my project when I realized the commented parameter was the issue. I then tried using a native variable type to see if the issue persisted - and it did.
It's not really an issue I need fixing per say - just wondering why this happens.
Thanks in advance!
The text was updated successfully, but these errors were encountered: