diff --git a/src/Microsoft.Windows.CsWin32/Generator.cs b/src/Microsoft.Windows.CsWin32/Generator.cs index b34e59e6..64d6ed3c 100644 --- a/src/Microsoft.Windows.CsWin32/Generator.cs +++ b/src/Microsoft.Windows.CsWin32/Generator.cs @@ -547,7 +547,7 @@ public bool TryGenerateType(string possiblyQualifiedName, out IReadOnlyList this.RequestSpecialTypeDefStruct(typeName, out fullyQualifiedName)); diff --git a/test/Microsoft.Windows.CsWin32.Tests/StructTests.cs b/test/Microsoft.Windows.CsWin32.Tests/StructTests.cs index 88e98c13..c1871578 100644 --- a/test/Microsoft.Windows.CsWin32.Tests/StructTests.cs +++ b/test/Microsoft.Windows.CsWin32.Tests/StructTests.cs @@ -174,6 +174,19 @@ public void FieldWithAssociatedEnum() Assert.Equal("SHDID_ID", Assert.IsType(property.Type).Identifier.ValueText); } + [Theory] + [InlineData("PCSTR")] + public void SpecialStruct_ByRequest(string structName) + { + this.generator = this.CreateGenerator(); + Assert.True(this.generator.TryGenerate(structName, out IReadOnlyList preciseApi, CancellationToken.None)); + Assert.Single(preciseApi); + this.CollectGeneratedCode(this.generator); + this.AssertNoDiagnostics(); + + var type = (StructDeclarationSyntax)Assert.Single(this.FindGeneratedType(structName)); + } + [Theory] [CombinatorialData] public void InterestingStructs(