@@ -1145,16 +1145,8 @@ private void ConfirmModuleAttributePresentAndAddingToAssemblyResultsInSignedOutp
11451145 using ( var metadata = ModuleMetadata . CreateFromStream ( moduleContents ) )
11461146 {
11471147 var flags = metadata . Module . PEReaderOpt . PEHeaders . CorHeader . Flags ;
1148- if ( legacyStrongName )
1149- {
1150- //confirm file does not claim to be signed
1151- Assert . Equal ( 0 , ( int ) ( flags & CorFlags . StrongNameSigned ) ) ;
1152- }
1153- else
1154- {
1155- // It should have been signed in the stream
1156- Assert . NotEqual ( 0 , ( int ) ( flags & CorFlags . StrongNameSigned ) ) ;
1157- }
1148+ //confirm file does not claim to be signed
1149+ Assert . Equal ( 0 , ( int ) ( flags & CorFlags . StrongNameSigned ) ) ;
11581150
11591151 EntityHandle token = metadata . Module . GetTypeRef ( metadata . Module . GetAssemblyRef ( "mscorlib" ) , "System.Runtime.CompilerServices" , "AssemblyAttributesGoHere" ) ;
11601152 Assert . False ( token . IsNil ) ; //could the type ref be located? If not then the attribute's not there.
@@ -1599,52 +1591,49 @@ static void Goo() {}
15991591 Assert . True ( emitResult . Success ) ;
16001592 }
16011593
1602- private void DelaySignWithAssemblySignatureKeyHelper ( StrongNameProvider provider )
1594+ [ Fact ]
1595+ public void DelaySignWithAssemblySignatureKey ( )
16031596 {
1604- //Note that this SignatureKey is some random one that I found in the devdiv build.
1605- //It is not related to the other keys we use in these tests.
1597+ DelaySignWithAssemblySignatureKeyHelper ( s_defaultPortableProvider ) ;
1598+ DelaySignWithAssemblySignatureKeyHelper ( s_defaultDesktopProvider ) ;
16061599
1607- //In the native compiler, when the AssemblySignatureKey attribute is present, and
1608- //the binary is configured for delay signing, the contents of the assemblySignatureKey attribute
1609- //(rather than the contents of the keyfile or container) are used to compute the size needed to
1610- //reserve in the binary for its signature. Signing using this key is only supported via sn.exe
1600+ void DelaySignWithAssemblySignatureKeyHelper ( StrongNameProvider provider )
1601+ {
1602+ //Note that this SignatureKey is some random one that I found in the devdiv build.
1603+ //It is not related to the other keys we use in these tests.
16111604
1612- var options = TestOptions . ReleaseDll
1613- . WithDelaySign ( true )
1614- . WithCryptoKeyFile ( s_keyPairFile )
1615- . WithStrongNameProvider ( provider ) ;
1605+ //In the native compiler, when the AssemblySignatureKey attribute is present, and
1606+ //the binary is configured for delay signing, the contents of the assemblySignatureKey attribute
1607+ //(rather than the contents of the keyfile or container) are used to compute the size needed to
1608+ //reserve in the binary for its signature. Signing using this key is only supported via sn.exe
16161609
1617- var other = CreateCompilation (
1618- @"
1610+ var options = TestOptions . ReleaseDll
1611+ . WithDelaySign ( true )
1612+ . WithCryptoKeyFile ( s_keyPairFile )
1613+ . WithStrongNameProvider ( provider ) ;
1614+
1615+ var other = CreateCompilation (
1616+ @"
16191617[assembly: System.Reflection.AssemblyDelaySign(true)]
16201618[assembly: System.Reflection.AssemblySignatureKey(""002400000c800000140100000602000000240000525341310008000001000100613399aff18ef1a2c2514a273a42d9042b72321f1757102df9ebada69923e2738406c21e5b801552ab8d200a65a235e001ac9adc25f2d811eb09496a4c6a59d4619589c69f5baf0c4179a47311d92555cd006acc8b5959f2bd6e10e360c34537a1d266da8085856583c85d81da7f3ec01ed9564c58d93d713cd0172c8e23a10f0239b80c96b07736f5d8b022542a4e74251a5f432824318b3539a5a087f8e53d2f135f9ca47f3bb2e10aff0af0849504fb7cea3ff192dc8de0edad64c68efde34c56d302ad55fd6e80f302d5efcdeae953658d3452561b5f36c542efdbdd9f888538d374cef106acf7d93a4445c3c73cd911f0571aaf3d54da12b11ddec375b3"", ""a5a866e1ee186f807668209f3b11236ace5e21f117803a3143abb126dd035d7d2f876b6938aaf2ee3414d5420d753621400db44a49c486ce134300a2106adb6bdb433590fef8ad5c43cba82290dc49530effd86523d9483c00f458af46890036b0e2c61d077d7fbac467a506eba29e467a87198b053c749aa2a4d2840c784e6d"")]
16211619public class C
16221620{
16231621 static void Goo() {}
16241622}" ,
1625- new MetadataReference [ ] { MscorlibRef_v4_0_30316_17626 } ,
1626- options : options ) ;
1623+ new MetadataReference [ ] { MscorlibRef_v4_0_30316_17626 } ,
1624+ options : options ) ;
16271625
1628- using ( var metadata = ModuleMetadata . CreateFromImage ( other . EmitToArray ( ) ) )
1629- {
1630- var header = metadata . Module . PEReaderOpt . PEHeaders . CorHeader ;
1631- //confirm header has expected SN signature size
1632- Assert . Equal ( 256 , header . StrongNameSignatureDirectory . Size ) ;
1626+ using ( var metadata = ModuleMetadata . CreateFromImage ( other . EmitToArray ( ) ) )
1627+ {
1628+ var header = metadata . Module . PEReaderOpt . PEHeaders . CorHeader ;
1629+ //confirm header has expected SN signature size
1630+ Assert . Equal ( 256 , header . StrongNameSignatureDirectory . Size ) ;
1631+ // Delay sign should not have the strong name flag set
1632+ Assert . Equal ( CorFlags . ILOnly , header . Flags ) ;
1633+ }
16331634 }
16341635 }
16351636
1636- [ Fact ]
1637- public void DelaySignWithAssemblySignatureKey ( )
1638- {
1639- DelaySignWithAssemblySignatureKeyHelper ( s_defaultPortableProvider ) ;
1640- }
1641-
1642- [ Fact ]
1643- public void DelaySignWithAssemblySignatureKey_Legacy ( )
1644- {
1645- DelaySignWithAssemblySignatureKeyHelper ( s_defaultDesktopProvider ) ;
1646- }
1647-
16481637 [ WorkItem ( 545720 , "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545720" ) ]
16491638 [ WorkItem ( 530050 , "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530050" ) ]
16501639 [ Fact ]
0 commit comments