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

Can't serialize a ProjectId with a null DebugName #23520

Closed
KirillOsenkov opened this issue Dec 1, 2017 · 3 comments
Closed

Can't serialize a ProjectId with a null DebugName #23520

KirillOsenkov opened this issue Dec 1, 2017 · 3 comments
Labels
Resolution-By Design The behavior reported in the issue matches the current design

Comments

@KirillOsenkov
Copy link
Member

Version Used:
https://dotnet.myget.org/feed/roslyn-for-vs-for-mac/package/nuget/Microsoft.CodeAnalysis.Workspaces.Common/2.7.0-vs-for-mac-62330-03

Steps to Reproduce:

MonoDevelop has a unit-test that crashes because the ProjectId has a null DebugName:
http://source.monodevelop.com/#MonoDevelop.CSharpBinding.Tests/MonoDevelop.CSharpBinding.Refactoring/CSharpFindReferencesProviderTests.cs,ced55906c09ac9c1

Expected Behavior:
Should be able to serialize a null string here:
https://github.com/dotnet/roslyn/blob/master/src/Workspaces/Core/Portable/Workspace/Solution/ProjectId.cs#L90

Actual Behavior:
Crash:

  at <unknown> <0xffffffff>
  at Roslyn.Utilities.ObjectWriter.WriteString (string) [0x00000] in /_/src/Compilers/Core/Portable/Serialization/ObjectWriter.cs:120
  at Microsoft.CodeAnalysis.ProjectId.Roslyn.Utilities.IObjectWritable.WriteTo (Roslyn.Utilities.ObjectWriter) [0x0000c] in /_/src/Workspaces/Core/Portable/Workspace/Solution/ProjectId.cs:90
  at Microsoft.CodeAnalysis.Shared.Extensions.SolutionExtensions.WriteTo (Roslyn.Utilities.IObjectWritable,Roslyn.Utilities.ObjectWriter) [0x00000] in /_/src/Workspaces/Core/Portable/Shared/Extensions/SolutionExtensions.cs:11
  at Microsoft.CodeAnalysis.ProjectInfo/ProjectAttributes.WriteTo (Roslyn.Utilities.ObjectWriter) [0x00000] in /_/src/Workspaces/Core/Portable/Workspace/Solution/ProjectInfo.cs:438
  at Microsoft.CodeAnalysis.Checksum.Create (Microsoft.CodeAnalysis.Serialization.WellKnownSynchronizationKind,Roslyn.Utilities.IObjectWritable) [0x0001d] in /_/src/Workspaces/Core/Portable/Workspace/Solution/Checksum_Factory.cs:55
  at Microsoft.CodeAnalysis.ProjectInfo/ProjectAttributes.Microsoft.CodeAnalysis.IChecksummedObject.get_Checksum () [0x0000e] in /_/src/Workspaces/Core/Portable/Workspace/Solution/ProjectInfo.cs:478
  at Microsoft.CodeAnalysis.Serialization.Serializer.CreateChecksum (object,System.Threading.CancellationToken) [0x00028] in /_/src/Workspaces/Core/Portable/Execution/Serializer.cs:61
  at Microsoft.CodeAnalysis.ProjectState/<ComputeChecksumsAsync>d__111.MoveNext () [0x000c0] in /_/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState_Checksum.cs:41
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Microsoft.CodeAnalysis.Serialization.ProjectStateChecksums>.Start<Microsoft.CodeAnalysis.ProjectState/<ComputeChecksumsAsync>d__111> (Microsoft.CodeAnalysis.ProjectState/<ComputeChecksumsAsync>d__111&) [0x0002c] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471
  at Microsoft.CodeAnalysis.ProjectState.ComputeChecksumsAsync (System.Threading.CancellationToken) [0x0002f] in <04e532e269994a46ad655a7ff113b901>:0
  at Roslyn.Utilities.AsyncLazy`1<T_REF>.StartAsynchronousComputation (Roslyn.Utilities.AsyncLazy`1/AsynchronousComputationToStart<T_REF>,Roslyn.Utilities.AsyncLazy`1/Request<T_REF>,System.Threading.CancellationToken) [0x00013] in /_/src/Workspaces/Core/Portable/Utilities/AsyncLazy`1.cs:388
  at Roslyn.Utilities.AsyncLazy`1<T_REF>.GetValueAsync (System.Threading.CancellationToken) [0x00085] in /_/src/Workspaces/Core/Portable/Utilities/AsyncLazy`1.cs:344
  at Microsoft.CodeAnalysis.ProjectState.GetStateChecksumsAsync (System.Threading.CancellationToken) [0x00000] in /_/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState_Checksum.cs:21
  at Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex/<GetChecksumAsync>d__55.MoveNext () [0x00011] in /_/src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex_Persistence.cs:83
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Microsoft.CodeAnalysis.Checksum>.Start<Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex/<GetChecksumAsync>d__55> (Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex/<GetChecksumAsync>d__55&) [0x0002c] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471
  at Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex.GetChecksumAsync (Microsoft.CodeAnalysis.Document,System.Threading.CancellationToken) [0x0002f] in <04e532e269994a46ad655a7ff113b901>:0
  at Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex/<GetIndexWorkerAsync>d__10.MoveNext () [0x0001d] in /_/src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex.cs:75
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex>.Start<Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex/<GetIndexWorkerAsync>d__10> (Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex/<GetIndexWorkerAsync>d__10&) [0x0002c] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471
  at Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex.GetIndexWorkerAsync (Microsoft.CodeAnalysis.Document,System.Threading.CancellationToken) [0x0002f] in <04e532e269994a46ad655a7ff113b901>:0
  at Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex/<GetIndexAsync>d__9.MoveNext () [0x00035] in /_/src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex.cs:61
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex>.Start<Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex/<GetIndexAsync>d__9> (Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex/<GetIndexAsync>d__9&) [0x0002c] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471
  at Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex.GetIndexAsync (Microsoft.CodeAnalysis.Document,System.Threading.CancellationToken) [0x0002f] in <04e532e269994a46ad655a7ff113b901>:0```
@KirillOsenkov
Copy link
Member Author

Note: this is unconfirmed. We suspect that this could be a Mono runtime issue. It is unclear whether it's an actual issue in Roslyn too and they overlap or if Roslyn is not at fault. I will update this issue when we know more.

Mono runtime fix:
mono/mono@ddeba6e

Native stack:

Native stacktrace:

    0   libmonosgen-2.0.dylib               0x00000001032bc201 mono_handle_native_crash + 257
    1   libmonosgen-2.0.dylib               0x0000000103325586 altstack_handle_and_restore + 70
    2   libmonosgen-2.0.dylib               0x000000010327ad27 mono_local_cprop + 423
    3   libmonosgen-2.0.dylib               0x0000000103207a78 mini_method_compile + 4456
    4   libmonosgen-2.0.dylib               0x000000010320acd6 mono_jit_compile_method_inner + 790
    5   libmonosgen-2.0.dylib               0x000000010320e223 mono_jit_compile_method_with_opt + 1363
    6   libmonosgen-2.0.dylib               0x00000001032be6c1 common_call_trampoline + 1217
    7   libmonosgen-2.0.dylib               0x00000001032be1bc mono_magic_trampoline + 60```

@KirillOsenkov
Copy link
Member Author

We have now confirmed that this was a Mono runtime issue, fixed with mono/mono@ddeba6e.

Roslyn behaves as designed. Closing.

/cc @jasonmalinowski

@KirillOsenkov KirillOsenkov added the Resolution-By Design The behavior reported in the issue matches the current design label Dec 5, 2017
@KirillOsenkov
Copy link
Member Author

You need Mono >= 5.8.0.130 to avoid hitting this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-By Design The behavior reported in the issue matches the current design
Projects
None yet
Development

No branches or pull requests

1 participant