dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.04k stars 4.03k forks source link

Checksum throws on Mono 64-bit #23722

Closed DustinCampbell closed 6 years ago

DustinCampbell commented 6 years ago

Version Used: 2.6.0

The latest Roslyn release results in test failures in OmniSharp on Linux/OSX (failing build log: omnisharp-build-log.txt) that look so:

    OmniSharp.Roslyn.CSharp.Tests.RenameFacts.Rename_DoesNotUpdatesWorkspace [FAIL]
      System.AggregateException : One or more errors occurred.
      ---- System.ArgumentException : checksum must be a SHA-1 hash
      Parameter name: checksum
      Stack Trace:
          at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0 
          at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0 
          at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0 
          at Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex+<GetChecksumAsync>d__53.MoveNext () [0x00087] in <82fd95a6d9bb4f6e9a2da5a34e8280f2>:0 
        --- End of stack trace from previous location where exception was thrown ---

<snip lots of async state machine transitions>

        ----- Inner Stack Trace -----
          at Microsoft.CodeAnalysis.Checksum..ctor (System.Byte[] checksum) [0x00031] in <82fd95a6d9bb4f6e9a2da5a34e8280f2>:0 
          at Microsoft.CodeAnalysis.Checksum.ComputeChecksum (System.IO.Stream stream, System.Security.Cryptography.IncrementalHash hash) [0x00042] in <82fd95a6d9bb4f6e9a2da5a34e8280f2>:0 
          at Microsoft.CodeAnalysis.Checksum.Create (System.IO.Stream stream) [0x0000b] in <82fd95a6d9bb4f6e9a2da5a34e8280f2>:0 
          at Microsoft.CodeAnalysis.Checksum.Create (Microsoft.CodeAnalysis.Serialization.WellKnownSynchronizationKind kind, Roslyn.Utilities.IObjectWritable object) [0x00024] in <82fd95a6d9bb4f6e9a2da5a34e8280f2>:0 
          at Microsoft.CodeAnalysis.ProjectInfo+ProjectAttributes.Microsoft.CodeAnalysis.IChecksummedObject.get_Checksum () [0x0000e] in <82fd95a6d9bb4f6e9a2da5a34e8280f2>:0 
          at Microsoft.CodeAnalysis.Serialization.Serializer.CreateChecksum (System.Object value, System.Threading.CancellationToken cancellationToken) [0x00028] in <82fd95a6d9bb4f6e9a2da5a34e8280f2>:0 
          at Microsoft.CodeAnalysis.ProjectState+<ComputeChecksumsAsync>d__111.MoveNext () [0x000ce] in <82fd95a6d9bb4f6e9a2da5a34e8280f2>:0 

It appears that this is due to a struct layout padding issue on Mono 64-bit, which was found and "fixed" by https://github.com/dotnet/roslyn/pull/22794, but not in master. This is currently blocking OmniSharp, and thus, VS Code from taking a new Roslyn and adding support for C# 7.2.

jasonmalinowski commented 6 years ago

The fix we have in the refactorings branch will flow into master this week. If we do a fix sooner that's something other than a cherry-pick let me know as we'll have to resolve that then.