Skip to content

Commit c1961c4

Browse files
vlad-andreevvlad-andreev
andauthored
Catch and handle NRefactory parser exceptions (#6392)
Co-authored-by: vlad-andreev <[email protected]>
1 parent 510eb10 commit c1961c4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

com.unity.render-pipelines.core/Editor/ShaderGenerator/CSharpToHLSL.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,16 @@ static void LoadTypes(string fileName)
201201
}*/
202202
parser.Lexer.EvaluateConditionalCompilation = true;
203203

204-
parser.Parse();
204+
try
205+
{
206+
parser.Parse();
207+
}
208+
catch
209+
{
210+
Debug.LogWarning($"Unable to parse {fileName}. Please not that C# 6.0 syntax is not yet supported by this tool.");
211+
return;
212+
}
213+
205214
try
206215
{
207216
var visitor = new NamespaceVisitor();

0 commit comments

Comments
 (0)