diff --git a/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs b/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs index 4ff57cfd..abf4038c 100644 --- a/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs +++ b/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs @@ -218,6 +218,9 @@ namespace ComputeSharp.Shaders.Translation // Replace the discards source = Regex.Replace(source, @"(? $"out {m.Groups[1].Value} {new string(Guid.NewGuid().ToByteArray().Select(b => (char)('a' + b % 26)).ToArray())}"); + // Fix invalid C# names with @ prefix + source = Regex.Replace(source, @"@(\w+)", m => $"__at__{m.Groups[1].Value}"); + // Load the syntax tree and the entry node SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(source); MethodDeclarationSyntax rootNode = syntaxTree