Skip to content

Blazor cannot parse true ? "option1" : "option2" correctly #11869

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

Open
tplsoft opened this issue May 16, 2025 · 1 comment
Open

Blazor cannot parse true ? "option1" : "option2" correctly #11869

tplsoft opened this issue May 16, 2025 · 1 comment
Labels
area-compiler Umbrella for all compiler issues needs more info
Milestone

Comments

@tplsoft
Copy link

tplsoft commented May 16, 2025

this is a runtime issue and does not give too many details.

The code below throws the error
await JS.InvokeVoidAsync("initMonaco", EditorId, Language, "", true ? "vs-dark" : "vs");

it is easy to fix as below or simply assign a variable before the call.
await JS.InvokeVoidAsync("initMonaco", EditorId, Language, "", (true ? "vs-dark" : "vs"));

However, the main issue is that the compiler does not give an error, and there is no detail in the error as well. It only says "System.NullReferenceException: 'Object reference not set to an instance of an object.'"

@chsienki
Copy link
Member

Hi @tplsoft

Could you provide a little more information on how you're calling this. Is it in an @code block, an explicit @() expression or something else?

@chsienki chsienki added this to the 2025-06 June milestone May 16, 2025
@phil-allen-msft phil-allen-msft added the area-compiler Umbrella for all compiler issues label May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-compiler Umbrella for all compiler issues needs more info
Projects
None yet
Development

No branches or pull requests

3 participants