-
Notifications
You must be signed in to change notification settings - Fork 4k
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
string keyword is added by IntelliSense in error when specifying HtmlAttributes for LabelFor HTML Helper #63558
Comments
User report says its a Razor file, but its with the legacy editor, which means C# projection buffers, which means Roslyn. Repros in a normal .cs file too. Essentially the user wants to use an |
@davidwengier Sorry for offtop, but what program did you use to create such gif with keybord pressed keys shown? |
I use ScreenToGif (https://www.screentogif.com/). Since it's not obvious in the program how to add keystrokes, you can either:
|
I was the person that raised this originally on the Developer Community. I'm just curious - when you say this is the legacy editor, is that inevitable because I'm targeting .NET Framework? When our organisation (finally!) moves to .NET 6 will I automatically be using the non-legacy editor, or is that a change I need to make manually? |
Yes, .NET Framework projects get the legacy editor, but the other target frameworks have been migrated over to the new editor, so everything should be automatic when you update your projects. |
It looks like the completion might be a bit too confident in making a default (hard) selection based on the inferred types? If so, one potential solution is to use soft-selection instead of hard-select if user hasn't typed anything in this context (i.e. object creation) |
This issue has been moved from a ticket on Developer Community.
Whenever I add a
LabelFor
HTML Helper to a Razor view and hit the comma after the first parameter and then begin typing to add the htmlAttributes parameter, after I type thenew
keyword and then the opening brace, IntelliSense - every single time - inserts thestring
keyword before the curly brace. This is never the correct behaviour - htmlAttributes will always be an object.The problem is best illustrated by the little screen capture I've attached, but the result is that, thanks to IntelliSense, I end up with the following, in which I never typed
string
:@Html.LabelFor(model => model.FirstName, new string { })
This hasn't always been a problem. I feel like it's a bug that was introduced a few versions ago, but I can't say for sure when.
Original Comments
Feedback Bot on 8/4/2022, 00:10 PM:
(private comment, text removed)
Feedback Bot on 8/4/2022, 04:07 PM:
(private comment, text removed)
Andrew Hall 🤘 [MSFT] on 8/20/2022, 06:08 AM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: