Skip to content
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

[Bug] String interpolation with '}' #2147

Open
cloud42 opened this issue Feb 18, 2025 · 3 comments
Open

[Bug] String interpolation with '}' #2147

cloud42 opened this issue Feb 18, 2025 · 3 comments

Comments

@cloud42
Copy link

cloud42 commented Feb 18, 2025

int a = 1;
Debug.WriteLine($"abc {a} "); // OK
Debug.WriteLine($"abc {a} }"); // Error

@bfiete
Copy link
Collaborator

bfiete commented Feb 18, 2025

Yeah, that's illegal.

You have to "escape" those if you want to use them as literal chars: Debug.WriteLine($"abc {a} }}");

@bfiete bfiete closed this as completed Feb 18, 2025
@cloud42
Copy link
Author

cloud42 commented Feb 19, 2025

Thank you for the reply. However, can it be highlighted by the IDE like "{"?

Debug.WriteLine($"abc {a} { "); // This will cause an error in the IDE with a red line

Image

Debug.WriteLine($"abc {a} } "); // This will not show an error until a runtime exception occurs

Image

@bfiete
Copy link
Collaborator

bfiete commented Feb 19, 2025

That would be a nice feature, sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants