diff --git a/src/ComputeSharp.SourceGenerators/AutoConstructorAttributeGenerator.cs b/src/ComputeSharp.SourceGenerators/AutoConstructorAttributeGenerator.cs index 25d38475..78716f52 100644 --- a/src/ComputeSharp.SourceGenerators/AutoConstructorAttributeGenerator.cs +++ b/src/ComputeSharp.SourceGenerators/AutoConstructorAttributeGenerator.cs @@ -6,6 +6,7 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Text; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +using static Microsoft.CodeAnalysis.SymbolDisplayTypeQualificationStyle; namespace ComputeSharp.SourceGenerators { @@ -51,7 +52,7 @@ namespace ComputeSharp.SourceGenerators INamedTypeSymbol structDeclarationSymbol = semanticModel.GetDeclaredSymbol(structDeclaration)!; // Extract the info on the type to process - var namespaceName = structDeclarationSymbol.ContainingNamespace.Name; + var namespaceName = structDeclarationSymbol.ContainingNamespace.ToDisplayString(new(typeQualificationStyle: NameAndContainingTypesAndNamespaces)); var structName = structDeclaration.Identifier.Text; var structModifiers = structDeclaration.Modifiers; var fields = ( diff --git a/tests/ComputeSharp.Tests.Internals/SourceGeneratorTests.cs b/tests/ComputeSharp.Tests.Internals/SourceGeneratorTests.cs index 266dc6e6..bb4e3b1b 100644 --- a/tests/ComputeSharp.Tests.Internals/SourceGeneratorTests.cs +++ b/tests/ComputeSharp.Tests.Internals/SourceGeneratorTests.cs @@ -27,7 +27,7 @@ namespace ComputeSharp.Tests.Internals } } - namespace MyFancyApp + namespace MyFancyApp.Sample { [AutoConstructor] public readonly partial struct MyShader @@ -38,7 +38,7 @@ namespace ComputeSharp.Tests.Internals }"; string expected = @" - namespace MyFancyApp + namespace MyFancyApp.Sample { public readonly partial struct MyShader {