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

Debug.Assert hit in TriviaDataFactory.cs #77037

Open
JoeRobich opened this issue Feb 4, 2025 · 0 comments
Open

Debug.Assert hit in TriviaDataFactory.cs #77037

JoeRobich opened this issue Feb 4, 2025 · 0 comments
Labels
Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@JoeRobich
Copy link
Member

I frequently use a debug build of the Roslyn LSP and am repeatedly hitting this failing Assert.

var result = Analyzer.Between(token1, token2);
var info = GetWhitespaceOnlyTriviaInfo(token1, token2, result);
if (info != null)
{
Debug.Assert(string.IsNullOrWhiteSpace(this.TreeInfo.GetTextBetween(token1, token2)));
return info;
}

From exploring in the immediate window we see the problem is a zero-width space.

this.TreeInfo.GetTextBetween(token1, token2)
"\r\n\r\n"
string.IsNullOrWhiteSpace(this.TreeInfo.GetTextBetween(token1, token2))
false
this.TreeInfo.GetTextBetween(token1, token2).Length
5
this.TreeInfo.GetTextBetween(token1, token2)[0]
13 '\r'
this.TreeInfo.GetTextBetween(token1, token2)[1]
10 '\n'
this.TreeInfo.GetTextBetween(token1, token2)[2]
13 '\r'
this.TreeInfo.GetTextBetween(token1, token2)[3]
10 '\n'
this.TreeInfo.GetTextBetween(token1, token2)[4]
65279 ''
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

1 participant