Skip to content

Commit

Permalink
S3884: Add UTs for Alias any type
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioaversa committed Oct 4, 2023
1 parent 176773c commit b88b691
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public void SecurityPInvokeMethodShouldNotBeCalled_CS() =>
public void SecurityPInvokeMethodShouldNotBeCalled_CSharp11() =>
builderCS.AddPaths("SecurityPInvokeMethodShouldNotBeCalled.CSharp11.cs").WithOptions(ParseOptionsHelper.FromCSharp11).Verify();

[TestMethod]
public void SecurityPInvokeMethodShouldNotBeCalled_CSharp12() =>
builderCS.AddPaths("SecurityPInvokeMethodShouldNotBeCalled.CSharp12.cs").WithOptions(ParseOptionsHelper.FromCSharp12).Verify();

#endif

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Runtime.InteropServices;
using IntPtrAliasFromKeywork = nint;

class AliasAnyType
{
[DllImport("OlE32.dll")]
static extern int CoSetProxyBlanket(
[MarshalAs(UnmanagedType.IUnknown)] object pProxy,
uint dwAuthnSvc,
uint dwAuthzSvc,
[MarshalAs(UnmanagedType.LPWStr)] string pServerPrincName,
uint dwAuthnLevel,
IntPtrAliasFromKeywork dwImpLevel,
IntPtrAliasFromKeywork pAuthInfo,
uint dwCapabilities);

void Test()
{
_ = CoSetProxyBlanket(null, 0, 0, null, 0, 0, 0, 0); // Noncompliant
// ^^^^^^^^^^^^^^^^^
}
}

0 comments on commit b88b691

Please sign in to comment.