From 452ce516e2a4738a6ba039ef7d9bf5d57d8483fe Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Sat, 3 Feb 2024 18:07:37 -0800 Subject: [PATCH] Retry the other test that has the same issue. --- src/thirtytwo_tests/Win32/Foundation/HRESULTTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/thirtytwo_tests/Win32/Foundation/HRESULTTests.cs b/src/thirtytwo_tests/Win32/Foundation/HRESULTTests.cs index b2d08a0..0dbad61 100644 --- a/src/thirtytwo_tests/Win32/Foundation/HRESULTTests.cs +++ b/src/thirtytwo_tests/Win32/Foundation/HRESULTTests.cs @@ -7,9 +7,12 @@ namespace Windows.Win32.Foundation; public class HRESULTTests { - [Fact] + [RetryFact(MaxRetries = 5)] public void HRESULT_ToStringWithDescription() { + // The Marshal.GetExceptionForHR method is not thread safe for CLR (COR_E*) HRESULTs. + // We don't control all threads in the process, so we have to retry a few times. + // .NET exception messages aren't localized. (Only .NET Framework) string message = HRESULT.COR_E_OBJECTDISPOSED.ToStringWithDescription(); message.Should().Be("HRESULT 0x80131622 [-2146232798]: Cannot access a disposed object.");