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

Ctor_StartupTimeSimilarToUtcNow failing on Mac M1 on .NET Core #1508

Closed
mattjohnsonpint opened this issue Mar 3, 2022 · 1 comment · Fixed by #1510
Closed

Ctor_StartupTimeSimilarToUtcNow failing on Mac M1 on .NET Core #1508

mattjohnsonpint opened this issue Mar 3, 2022 · 1 comment · Fixed by #1510

Comments

@mattjohnsonpint
Copy link
Contributor

mattjohnsonpint commented Mar 3, 2022

Environment

MacBook Pro with M1 (Apple Silicon) hardware

Steps to Reproduce

  1. Install the .NET SDKs (6.0, 5.0, 3.1, 2.1)
  2. Clone the sentry-dotnet repo
  3. Built and test

Expected Result

Test passes for all runtime versions we target in the test suite.

Actual Result

Test fails for netcoreapp3.1, netcoreapp3.0, and netcoreapp2.1 only.

[xUnit.net 00:00:08.77]     Sentry.Tests.Internals.ProcessInfoTests.Ctor_StartupTimeSimilarToUtcNow [FAIL]
  Failed Sentry.Tests.Internals.ProcessInfoTests.Ctor_StartupTimeSimilarToUtcNow [9 ms]
  Error Message:
   diff isn't less expected 240 seconds: 45848.086737
Expected: True
Actual:   False
  Stack Trace:
     at Sentry.Tests.Internals.ProcessInfoTests.Ctor_StartupTimeSimilarToUtcNow() in /Users/matt/Code/sentry-dotnet/test/Sentry.Tests/Internals/ProcessInfoTests.cs:line 33
--- End of stack trace from previous location where exception was thrown ---

The diff time is > 12 hours, which is not possible when the test fails in a few seconds.

Initial investigation shows that the value of System.Diagnostics.Process.GetCurrentProcess().StartTime is erroneous, and thus our Sentry.Internal.ProcessInfo.StartupTime is bad. This appears to be a regression of dotnet/runtime#19928, which was resolved in .NET Core 2.0. Perhaps this due to the M1 hardware? If so, why does it not also fail on .NET 5.0 and 6.0? Need to dive in deeper to see if something else changed within .NET that would affect this.

Setting options.DetectStartupTime = StartupTimeDetectionMode.Fast avoids this path to pass the test, but that just hides the issue.

@mattjohnsonpint
Copy link
Contributor Author

Reported to .NET team: dotnet/runtime#66170

mattjohnsonpint added a commit that referenced this issue Mar 7, 2022
Repository owner moved this from Needs Discussion to Done in Mobile & Cross Platform SDK Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants