Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Microsoft.Windows.CsWin32/Generator.Handle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public partial class Generator
break;
case "LRESULT" when releaseMethod == "ICClose":
this.TryGenerateConstantOrThrow("ICERR_OK");
noerror = CastExpression(ParseName("global::Windows.Win32.Foundation.LRESULT"), MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName("PInvoke"), IdentifierName("ICERR_OK")));
noerror = CastExpression(ParseName("global::Windows.Win32.Foundation.LRESULT"), MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, this.methodsAndConstantsClassName, IdentifierName("ICERR_OK")));
releaseInvocation = BinaryExpression(SyntaxKind.EqualsExpression, releaseInvocation, noerror);
break;
case "HGLOBAL":
Expand Down
12 changes: 12 additions & 0 deletions test/CsWin32Generator.Tests/CsWin32GeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,18 @@ public async Task CrossWinMD_IInspectable(
await this.InvokeGeneratorAndCompile($"{nameof(this.CrossWinMD_IInspectable)}_{tfm}_{allowMarshaling}_{pinvokeClassName ?? "null"}");
}

[Theory, CombinatorialData]
public async Task ICCloseSafeHandle_CustomClassName(
[CombinatorialValues([null, "MyPInvoke"])] string? pinvokeClassName)
{
this.nativeMethodsJsonOptions = new NativeMethodsJsonOptions
{
ClassName = pinvokeClassName,
};
this.nativeMethods.Add("ICOpen");
await this.InvokeGeneratorAndCompile($"{nameof(this.ICCloseSafeHandle_CustomClassName)}_{pinvokeClassName ?? "null"}");
}

[Fact]
public async Task CrossWinMD_NTSTATUSSafeHandleConstant()
{
Expand Down
Loading