Suddenly I have started to get aforementioned issue during debugging unit tests. Here is a situation:
- Open project and open Tests Explorer.
- Select any test and try to debug it.
- Got message from title below the tool bar and break point in test would not be honored.
Things I tried with no avail:
- Update VS version. Has been:17.3.3 Now:17.3.6
- Repair VS.
Here is stack trace:
StreamJsonRpc.RemoteInvocationException: Read out of bounds. at StreamJsonRpc.JsonRpc.d__1431.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.EditAndContinue.RemoteEditAndContinueServiceProxy.<>c__DisplayClass5_0.<b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection1.d__201.MoveNext() RPC server exception: System.BadImageFormatException: Read out of bounds. at System.Reflection.Throw.OutOfBounds() at System.Reflection.Metadata.Ecma335.CustomDebugInformationTableReader..ctor(Int32 numberOfRows, Boolean declaredSorted, Int32 hasCustomDebugInformationRefSize, Int32 guidHeapRefSize, Int32 blobHeapRefSize, MemoryBlock containingBlock, Int32 containingBlockOffset) at System.Reflection.Metadata.MetadataReader.InitializeTableReaders(MemoryBlock metadataTablesMemoryBlock, HeapSizes heapSizes, Int32[] rowCounts, Int32[] externalRowCountsOpt) at System.Reflection.Metadata.MetadataReader..ctor(Byte* metadata, Int32 length, MetadataReaderOptions options, MetadataStringDecoder utf8Decoder, Object memoryOwner) at System.Reflection.Metadata.MetadataReaderProvider.GetMetadataReader(MetadataReaderOptions options, MetadataStringDecoder utf8Decoder) at Microsoft.CodeAnalysis.Debugging.DebugInformationReaderProvider.Portable.CreateEditAndContinueMethodDebugInfoReader() at Microsoft.CodeAnalysis.EditAndContinue.CommittedSolution.<>c__DisplayClass15_0.<b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.EditAndContinue.CommittedSolution.d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.EditAndContinue.EditAndContinueWorkspaceService.d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.EditAndContinue.RemoteEditAndContinueService.<>c__DisplayClass6_0.<b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<>c__DisplayClass10_01.<g__TryFastGetSolutionAndRunAsync|0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.d__101.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.d__111.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.d__14`1.MoveNext()
CodePudding user response:
Crisis been averted. After following actions situation went back 2 normal:
Uninstalled Postsharp nuget from Tests project
Removed from test project file following section:
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.11.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles;analyzers;buildtransitive</IncludeAssets> </PackageReference>
And after those actions no errors been produced and break points in tests been hit as expected. Weird.