File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed 
src/Microsoft.Windows.CsWin32 
test/Microsoft.Windows.CsWin32.Tests Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1605,7 +1605,7 @@ internal void RequestMacro(MethodDeclarationSyntax macro)
16051605    { 
16061606        this . volatileCode . GenerateMacro ( macro . Identifier . ValueText ,  delegate 
16071607        { 
1608-             this . volatileCode . AddMacro ( macro . Identifier . ValueText ,  macro ) ; 
1608+             this . volatileCode . AddMacro ( macro . Identifier . ValueText ,  ( MethodDeclarationSyntax ) ElevateVisibility ( macro ) ) ; 
16091609
16101610            // Generate any additional types that this macro relies on. 
16111611            foreach  ( QualifiedNameSyntax  identifier  in  macro . DescendantNodes ( ) . OfType < QualifiedNameSyntax > ( ) ) 
Original file line number Diff line number Diff line change @@ -607,6 +607,18 @@ public void HandleStructsHaveStaticNullMember(string handleName)
607607        this . AssertGeneratedMember ( handleName ,  "Null" ,  $ "internal static { handleName }  Null => default;") ; 
608608    } 
609609
610+     [ Theory ,  PairwiseData ] 
611+     public  void  MacroAPIsGenerateWithAppropriateVisibility ( bool  publicVisibility ) 
612+     { 
613+         this . generator  =  this . CreateGenerator ( DefaultTestGeneratorOptions  with  {  Public  =  publicVisibility  } ) ; 
614+         Assert . True ( this . generator . TryGenerate ( "HRESULT_FROM_WIN32" ,  CancellationToken . None ) ) ; 
615+         this . CollectGeneratedCode ( this . generator ) ; 
616+         this . AssertNoDiagnostics ( ) ; 
617+         var  method  =  Assert . Single ( this . FindGeneratedMethod ( "HRESULT_FROM_WIN32" ) ) ; 
618+ 
619+         Assert . True ( method . Modifiers . Any ( publicVisibility  ?  SyntaxKind . PublicKeyword  :  SyntaxKind . InternalKeyword ) ) ; 
620+     } 
621+ 
610622    [ Theory ] 
611623    [ InlineData ( "HRESULT_FROM_WIN32" ) ] 
612624    public  void  MacroAPIsGenerate ( string  macro ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments