Compile Time Errors when assigning HTML content with event handlers to a RenderFragment
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
Inside a razor-file in a @code { }, I'm trying to pass in some HTML content inside a RenderFragment-property as it shows in the 2 images above. The errors [CS1662, CS0027, CS0236] only appears when I try to assign a handler to an event. However, the code compiles and everything renders correctly if the events are not touched as shown in the image below.
Visual Studio 2022 - Version 17.14.20
Visual Studio 2026 Insiders - Version: Insiders [11206.111]
@AdmiralSnyder
Contributor guide
Research direction
The report provides screenshots but no repository files, minimal reproduction, or test name. Start by reproducing the RenderFragment assignment with an event handler in the reported Visual Studio and Razor setup, then compare it with the version without events. Done means the compiler errors are isolated and a regression test or confirmed compiler diagnosis is available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100