File tree 3 files changed +9
-6
lines changed
src/Microsoft.Windows.CsWin32
test/Microsoft.Windows.CsWin32.Tests
3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -499,7 +499,7 @@ static ExpressionSyntax ThisPointer(PointerTypeSyntax? typedPointer = null)
499
499
}
500
500
501
501
// Add helper methods when appropriate.
502
- if ( hasIUnknownMembers )
502
+ if ( hasIUnknownMembers && this . Options . FriendlyOverloads . Enabled )
503
503
{
504
504
members . AddRange ( this . ExtractMembersFromTemplate ( "IUnknownHelperMethods" ) ) ;
505
505
}
Original file line number Diff line number Diff line change 3
3
internal unsafe global ::Windows . Win32 . Foundation . HRESULT QueryInterface < T > ( out T * ppv )
4
4
where T : unmanaged
5
5
{
6
- var hr = this . QueryInterface ( typeof ( T ) . GUID , out void * pv ) ;
6
+ Guid guid = typeof ( T ) . GUID ;
7
+ void * pv ;
8
+ var hr = this . QueryInterface ( & guid , & pv ) ;
7
9
if ( hr . Succeeded )
8
10
{
9
11
ppv = ( T * ) pv ;
Original file line number Diff line number Diff line change @@ -457,13 +457,14 @@ a is
457
457
} ) ) ;
458
458
}
459
459
460
- [ Fact ]
461
- public void IUnknown_QueryInterfaceGenericHelper ( )
460
+ [ Theory , PairwiseData ]
461
+ public void IUnknown_QueryInterfaceGenericHelper ( bool friendlyOverloads )
462
462
{
463
- this . generator = this . CreateGenerator ( new GeneratorOptions { AllowMarshaling = false } ) ;
463
+ this . generator = this . CreateGenerator ( new GeneratorOptions { AllowMarshaling = false , FriendlyOverloads = new GeneratorOptions . FriendlyOverloadOptions { Enabled = friendlyOverloads } } ) ;
464
464
465
465
this . GenerateApi ( "IUnknown" ) ;
466
- Assert . Contains ( this . FindGeneratedMethod ( "QueryInterface" ) , m => m . TypeParameterList ? . Parameters . Count == 1 ) ;
466
+ bool matchFound = this . FindGeneratedMethod ( "QueryInterface" ) . Any ( m => m . TypeParameterList ? . Parameters . Count == 1 ) ;
467
+ Assert . Equal ( friendlyOverloads , matchFound ) ;
467
468
}
468
469
469
470
[ Fact ]
You can’t perform that action at this time.
0 commit comments