Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcing auto binding redirects on Microsoft.Extensions.Logging.Console.Tests to fix test issue. #78250

Merged

Conversation

joperezr
Copy link
Member

@ghost
Copy link

ghost commented Nov 11, 2022

Tagging subscribers to this area: @dotnet/area-extensions-logging
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #77988

cc: @carlossanlop @tarekgh @ViktorHofer @ericstj

Author: joperezr
Assignees: -
Labels:

area-Extensions-Logging

Milestone: -

Copy link
Member

@tarekgh tarekgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @joperezr

Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a scoped change. Wouldn't it make more sense to fix the assembly version mismatch between ref and src?

@joperezr
Copy link
Member Author

joperezr commented Nov 11, 2022

It is, intentionally. This is a release branch, so the idea was to provide a fix that was as scoped as possible to mitigate risk, and if possible to avoid changes to non-test code. Given System.Text.Json is inbox in .NET Core, as well as the fact that we don't generally bump reference assemblies build version when we patch unless the ref actually had changes, I'm not convinced that fixing the ref version is correct. Also, src version needs to be 7.0.0.1 and can't be rolled back, as this is a desktop assembly that could be installed on the GAC. One alternative that was possible and still safe in release branch, was to set this property to true for all test projects that have a net48 config, but again, I intentionally picked the scoped fix given we are in a release branch. My suggestion is that if we want a different solution in terms of infrastructure (like making tests build against ref, or setting auto binding redirects to true for all test projects) to happen in main first, and then cherry-picked to release if it makes sense.

@tarekgh
Copy link
Member

tarekgh commented Nov 12, 2022

@carlossanlop can you merge this? we need to port this fix to main too I guess.

@ericstj
Copy link
Member

ericstj commented Nov 12, 2022

We should fix the reference to avoid the need for binding redirects. The mismatch here is due to a reference to the non-shipping reference assembly.

@joperezr no one is suggesting any version changes to shipping reference assemblies. Of course we don’t do that in servicing.

Enabling auto redirects actually ships this bug to customers. We don’t need to do that.

@tarekgh
Copy link
Member

tarekgh commented Nov 12, 2022

We should fix the reference to avoid the need for binding redirects. The mismatch here is due to a reference to the non-shipping reference assembly.

Do you mean this reference?

<ProjectReference Include="$(LibrariesProjectRoot)System.Text.Json\ref\System.Text.Json.csproj" />

@joperezr
Copy link
Member Author

Enabling auto redirects actually ships this bug to customers. We don’t need to do that.

I'm not sure I follow this. I'm only enabling this on one of our test projects. Unless I'm misunderstanding something, if we change the reference from M.E.L.C to S.T.J from 7.0.0.0 to 7.0.0.1, then this package would be broken when people try to use it in 7.0.100 SDK application (since that one has the unserviced S.T.J).

@joperezr
Copy link
Member Author

Oh, I guess I forgot S.T.J ships in a Nuget package so in that case conflict resolution would pick the oob one and it would be fine. If that change is preferred I'm fine, that said it would no longer be a test only change, so it would require tactics approval, and by extent it would take longer to fix the build.

@ericstj
Copy link
Member

ericstj commented Nov 12, 2022

I want the serviced M.E.L.C which references the serviced S.T.J package have assembly references which are consistent with package references.

I forgot S.T.J ships in a Nuget package so in that case conflict resolution would pick the oob one

Nothing on .NETCore is impacted. We don’t increment the version there. It’s only netfx.

We just need to make the reference targets behave more like the packages do (no reference assemblies when consumer is packable and referencing a packable project). Let me see if I can find where to look.

As far as this PR is concerned we could merge it to unblock CI but we should fix this before shipping.

@ericstj
Copy link
Member

ericstj commented Nov 12, 2022

Maybe here?

'%(_resolvedP2PFiltered.SkipUseReferenceAssembly)' == 'true'"

I’d like @ViktorHofer to look and weigh in since he built a lot of this. I think there should be a very targeted fix here to make the projectreference omit the reference assembly Metadata. The condition could either be “both sides are packable” or “reference is packable and the TFM isn’t a NetCoreAppCurrent TFM”.

@ghost
Copy link

ghost commented Nov 12, 2022

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #77988

cc: @carlossanlop @tarekgh @ViktorHofer @ericstj

Author: joperezr
Assignees: joperezr
Labels:

area-Infrastructure

Milestone: -

@ghost
Copy link

ghost commented Nov 12, 2022

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #77988

cc: @carlossanlop @tarekgh @ViktorHofer @ericstj

Author: joperezr
Assignees: joperezr
Labels:

area-Infrastructure-libraries

Milestone: -

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as a targeted fix to unblock CI failures. We want to revert this change when we have a general solution that makes sure that assembly versions are in sync during servicing or by not referencing the reference assembly at all in cases when those aren't shipping to customers.

@carlossanlop
Copy link
Member

Merging now.
CI failures unrelated:

  • System.Net.Sockets timeout
===========================================================================================================

C:\h\w\AED60A04\w\B72F0A07\e>"C:\h\w\AED60A04\p\dotnet.exe" exec --runtimeconfig System.Net.Sockets.Tests.runtimeconfig.json --depsfile System.Net.Sockets.Tests.deps.json xunit.console.dll System.Net.Sockets.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing  
  Discovering: System.Net.Sockets.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  System.Net.Sockets.Tests (found 1332 of 1711 test cases)
  Starting:    System.Net.Sockets.Tests (parallel test collections = on, max threads = 2)
    System.Net.Sockets.Tests.KeepAliveTest.Socket_KeepAlive_RetryCount_Success [SKIP]
      Condition(s) not met: "IsUnixOrWindowsAtLeast1703"
    System.Net.Sockets.Tests.UnixDomainSocketTest.Socket_ConnectAsyncUnixDomainSocketEndPoint_Success [SKIP]
      Condition(s) not met: "OSSupportsUnixDomainSockets"
    System.Net.Sockets.Tests.UnixDomainSocketTest.FilePathEquality [SKIP]
      Condition(s) not met: "OSSupportsUnixDomainSockets"
    System.Net.Sockets.Tests.UnixDomainSocketTest.Socket_SendReceive_Success [SKIP]
      Condition(s) not met: "OSSupportsUnixDomainSockets"
    System.Net.Sockets.Tests.UnixDomainSocketTest.Socket_ConnectAsyncUnixDomainSocketEndPoint_NotServer [SKIP]
      Condition(s) not met: "OSSupportsUnixDomainSockets"
    System.Net.Sockets.Tests.UnixDomainSocketTest.Socket_SendReceive_Clone_Success [SKIP]
      Condition(s) not met: "OSSupportsUnixDomainSockets"
    System.Net.Sockets.Tests.UnixDomainSocketTest.UnixDomainSocketEndPoint_RemoteEndPointEqualsBindAddress [SKIP]
      Condition(s) not met: "OSSupportsUnixDomainSockets"
    System.Net.Sockets.Tests.UnixDomainSocketTest.AbstractPathEquality [SKIP]
      Condition(s) not met: "OSSupportsUnixDomainSockets"
    System.Net.Sockets.Tests.UnixDomainSocketTest.ConcurrentSendReceiveAsync [SKIP]
      Condition(s) not met: "OSSupportsUnixDomainSockets"
    System.Net.Sockets.Tests.UnixDomainSocketTest.UnixDomainSocketEndPoint_InvalidPaths_Throws [SKIP]
      Condition(s) not met: "OSSupportsUnixDomainSockets"
    System.Net.Sockets.Tests.UnixDomainSocketTest.Socket_SendReceiveAsync_Success [SKIP]
      Condition(s) not met: "OSSupportsUnixDomainSockets"
   System.Net.Sockets.Tests: [Long Running Test] 'System.Net.Sockets.Tests.SendReceive_Eap.Send_0ByteSend_Success', Elapsed: 00:02:16
[Long Running Test] 'System.Net.Sockets.Tests.ReceiveFrom_Eap.ReceiveSent_UDP_Success', Elapsed: 00:02:17
   System.Net.Sockets.Tests: [Long Running Test] 'System.Net.Sockets.Tests.SendReceive_Eap.Send_0ByteSend_Success', Elapsed: 00:04:16
[Long Running Test] 'System.Net.Sockets.Tests.ReceiveFrom_Eap.ReceiveSent_UDP_Success', Elapsed: 00:04:17
   System.Net.Sockets.Tests: [Long Running Test] 'System.Net.Sockets.Tests.SendReceive_Eap.Send_0ByteSend_Success', Elapsed: 00:06:16
[Long Running Test] 'System.Net.Sockets.Tests.ReceiveFrom_Eap.ReceiveSent_UDP_Success', Elapsed: 00:06:17
   System.Net.Sockets.Tests: [Long Running Test] 'System.Net.Sockets.Tests.SendReceive_Eap.Send_0ByteSend_Success', Elapsed: 00:08:16
[Long Running Test] 'System.Net.Sockets.Tests.ReceiveFrom_Eap.ReceiveSent_UDP_Success', Elapsed: 00:08:17
   System.Net.Sockets.Tests: [Long Running Test] 'System.Net.Sockets.Tests.SendReceive_Eap.Send_0ByteSend_Success', Elapsed: 00:10:16
[Long Running Test] 'System.Net.Sockets.Tests.ReceiveFrom_Eap.ReceiveSent_UDP_Success', Elapsed: 00:10:17
   System.Net.Sockets.Tests: [Long Running Test] 'System.Net.Sockets.Tests.SendReceive_Eap.Send_0ByteSend_Success', Elapsed: 00:12:16
[Long Running Test] 'System.Net.Sockets.Tests.ReceiveFrom_Eap.ReceiveSent_UDP_Success', Elapsed: 00:12:17
   System.Net.Sockets.Tests: [Long Running Test] 'System.Net.Sockets.Tests.SendReceive_Eap.Send_0ByteSend_Success', Elapsed: 00:14:16
[Long Running Test] 'System.Net.Sockets.Tests.ReceiveFrom_Eap.ReceiveSent_UDP_Success', Elapsed: 00:14:17
['System.Net.Sockets.Tests' END OF WORK ITEM LOG: Command timed out, and was killed]
===========================================================================================================

C:\helix\work\workitem\e>"C:\helix\work\correlation\dotnet.exe" exec --runtimeconfig System.Security.Cryptography.Cng.Tests.runtimeconfig.json --depsfile System.Security.Cryptography.Cng.Tests.deps.json xunit.console.dll System.Security.Cryptography.Cng.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing  
  Discovering: System.Security.Cryptography.Cng.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  System.Security.Cryptography.Cng.Tests (found 1049 of 1208 test cases)
  Starting:    System.Security.Cryptography.Cng.Tests (parallel test collections = on, max threads = 2)
    System.Security.Cryptography.Rsa.Tests.KeyGeneration.GenerateMaxKey [SKIP]
      Condition(s) not met: "IsStressModeEnabled"
    System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_AllocatingSpan.RsaCryptRoundtrip_OaepSHA256 [FAIL]
      System.Security.Cryptography.CryptographicException : Unknown error (0xc0000001)
      Stack Trace:
        /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs(278,0): at System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(SafeNCryptKeyHandle key, ReadOnlySpan`1 input, Span`1 output, AsymmetricPaddingMode paddingMode, Void* paddingInfo, Boolean encrypt, Int32& bytesWritten)
        /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs(185,0): at System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Boolean encrypt, Int32& bytesWritten)
        /_/src/libraries/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs(33,0): at System.Security.Cryptography.RSACng.TryDecrypt(ReadOnlySpan`1 data, Span`1 destination, RSAEncryptionPadding padding, Int32& bytesWritten)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs(231,0): at System.Security.Cryptography.RSA.<Decrypt>g__TryWithDecrypt|16_0(RSA rsa, ReadOnlySpan`1 input, Byte[] destination, RSAEncryptionPadding padding, Int32& bytesWritten)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs(1414,0): at System.Security.Cryptography.RSA.TryWithKeyBuffer[TState](ReadOnlySpan`1 input, TState state, TryFunc`1 callback, Boolean tryKeySizeFirst)
        /_/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSA.cs(234,0): at System.Security.Cryptography.RSA.Decrypt(ReadOnlySpan`1 data, RSAEncryptionPadding padding)
        /_/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs(45,0): at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt_AllocatingSpan.Decrypt(RSA rsa, Byte[] data, RSAEncryptionPadding padding)
        /_/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs(334,0): at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip(RSAEncryptionPadding paddingMode, Boolean expectSuccess)
        /_/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs(308,0): at System.Security.Cryptography.Rsa.Tests.EncryptDecrypt.RsaCryptRoundtrip_OaepSHA256()
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(69,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Security.Cryptography.Encryption.TripleDes.Tests.TripleDESContractTests.Windows7DoesNotSupportCFB64 [SKIP]
      Condition(s) not met: "IsWindows7"
    System.Security.Cryptography.Encryption.Aes.Tests.AesModeTests.Windows7DoesNotSupportCFB128 [SKIP]
      Condition(s) not met: "IsWindows7"
    System.Security.Cryptography.EcDsa.Tests.ECDsaTests_Stream.SignHash_DifferentHashes(ecdsa: ECDsaCng { HashAlgorithm = SHA256, Key = CngKey { Algorithm = ECDSA_P521, AlgorithmGroup = ECDSA, ExportPolicy = AllowPlaintextExport, Handle = SafeNCryptKeyHandle { ... }, IsEphemeral = True, ... }, KeyExchangeAlgorithm = null, KeySize = 521, LegalKeySizes = [KeySizes { ... }, KeySizes { ... }], ... }) [SKIP]
      SignHash not implemented.
    System.Security.Cryptography.EcDsa.Tests.ECDsaTests_Stream.SignHash_Roundtrip(ecdsa: ECDsaCng { HashAlgorithm = SHA256, Key = CngKey { Algorithm = ECDSA_P521, AlgorithmGroup = ECDSA, ExportPolicy = AllowPlaintextExport, Handle = SafeNCryptKeyHandle { ... }, IsEphemeral = True, ... }, KeyExchangeAlgorithm = null, KeySize = 521, LegalKeySizes = [KeySizes { ... }, KeySizes { ... }], ... }) [SKIP]
      SignHash not implemented.
    System.Security.Cryptography.EcDsa.Tests.ECDsaTests_Stream.SignHash_TamperedSignature(ecdsa: ECDsaCng { HashAlgorithm = SHA256, Key = CngKey { Algorithm = ECDSA_P521, AlgorithmGroup = ECDSA, ExportPolicy = AllowPlaintextExport, Handle = SafeNCryptKeyHandle { ... }, IsEphemeral = True, ... }, KeyExchangeAlgorithm = null, KeySize = 521, LegalKeySizes = [KeySizes { ... }, KeySizes { ... }], ... }) [SKIP]
      SignHash not implemented.
    System.Security.Cryptography.EcDsa.Tests.ECDsaTests_Array.SignHash_DifferentHashes(ecdsa: ECDsaCng { HashAlgorithm = SHA256, Key = CngKey { Algorithm = ECDSA_P521, AlgorithmGroup = ECDSA, ExportPolicy = AllowPlaintextExport, Handle = SafeNCryptKeyHandle { ... }, IsEphemeral = True, ... }, KeyExchangeAlgorithm = null, KeySize = 521, LegalKeySizes = [KeySizes { ... }, KeySizes { ... }], ... }) [SKIP]
      SignHash not implemented.
    System.Security.Cryptography.EcDsa.Tests.ECDsaTests_Array.SignHash_TamperedSignature(ecdsa: ECDsaCng { HashAlgorithm = SHA256, Key = CngKey { Algorithm = ECDSA_P521, AlgorithmGroup = ECDSA, ExportPolicy = AllowPlaintextExport, Handle = SafeNCryptKeyHandle { ... }, IsEphemeral = True, ... }, KeyExchangeAlgorithm = null, KeySize = 521, LegalKeySizes = [KeySizes { ... }, KeySizes { ... }], ... }) [SKIP]
      SignHash not implemented.
    System.Security.Cryptography.EcDsa.Tests.ECDsaTests_Array.SignHash_Roundtrip(ecdsa: ECDsaCng { HashAlgorithm = SHA256, Key = CngKey { Algorithm = ECDSA_P521, AlgorithmGroup = ECDSA, ExportPolicy = AllowPlaintextExport, Handle = SafeNCryptKeyHandle { ... }, IsEphemeral = True, ... }, KeyExchangeAlgorithm = null, KeySize = 521, LegalKeySizes = [KeySizes { ... }, KeySizes { ... }], ... }) [SKIP]
      SignHash not implemented.
  Finished:    System.Security.Cryptography.Cng.Tests
=== TEST EXECUTION SUMMARY ===
   System.Security.Cryptography.Cng.Tests  Total: 2801, Errors: 0, Failed: 1, Skipped: 9, Time: 34.374s
----- end Fri 11/11/2022 23:44:21.07 ----- exit code 1 ----------------------------------------------------------

@carlossanlop carlossanlop merged commit 0b558e8 into dotnet:release/7.0 Nov 14, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants