You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.reference="Lib" // line 1
return "Hello world" // line 2 (With missing semicolon)
Will produce a roslyn diagnostic for the missing semicolon, but with location on Line 1, because the directive line is stripped before the remaining lines are compiled to a csharpscript.
Expected behavior
The compiler diagnostic in the above example is for Line 2.
That is, roslyn diagnostics have locations that make sense in the overall buffer including directives, because that is the buffer the user is likely to edit in a user interface.
Actual behavior
Roslyn diagnostics have locations that are only correct in the buffer after the directive lines with leading dots are removed.
I speculate that this could be easy to fix by simply including the directive lines commented out to the CSharpScript, instead of removing them. So instead of sending this array of 1 line
return Hello world
This array of 2 lines should be the Script source:
//.reference="Lib"
return Hello world
I'll attempt to make a PR with this solution if it looks acceptable.
Diagnostic logs
Environment
v0.9.2-35-ga24ff33
The text was updated successfully, but these errors were encountered:
Steps to reproduce
A rule source with
Will produce a roslyn diagnostic for the missing semicolon, but with location on Line 1, because the directive line is stripped before the remaining lines are compiled to a csharpscript.
Expected behavior
The compiler diagnostic in the above example is for Line 2.
That is, roslyn diagnostics have locations that make sense in the overall buffer including directives, because that is the buffer the user is likely to edit in a user interface.
Actual behavior
Roslyn diagnostics have locations that are only correct in the buffer after the directive lines with leading dots are removed.
I speculate that this could be easy to fix by simply including the directive lines commented out to the CSharpScript, instead of removing them. So instead of sending this array of 1 line
This array of 2 lines should be the Script source:
I'll attempt to make a PR with this solution if it looks acceptable.
Diagnostic logs
Environment
v0.9.2-35-ga24ff33
The text was updated successfully, but these errors were encountered: