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

"Go to Definition" crashes with BadImageFormatException for System.Net.IPEndPoint #75118

Closed
just-ero opened this issue Sep 14, 2024 · 3 comments · Fixed by #76182
Closed

"Go to Definition" crashes with BadImageFormatException for System.Net.IPEndPoint #75118

just-ero opened this issue Sep 14, 2024 · 3 comments · Fixed by #76182
Assignees
Labels
Milestone

Comments

@just-ero
Copy link

Version Used

Compiler: 4.12.0-3.24430.2 (2805273)
.NET: 9.0.100-rc.1.24452.12
Visual Studio Code: 1.93.1, 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40, x64
C# Extension: v2.46.32
C# Dev Kit Extension: v1.11.6

Steps to Reproduce

  1. Create or open a C# project in Visual Studio Code (have not tested Visual Studio).
  2. Use System.Net.IPEndPoint anywhere.
  3. Attempt to navigate to the definition for IPEndPoint.

Expected Behavior

Navigation succeeds

Actual Behavior

It does not:

[Error - 3:34:50 AM] [LanguageServerHost] System.BadImageFormatException: Read out of bounds.
   at System.Reflection.Throw.OutOfBounds()
   at Microsoft.CodeAnalysis.PdbSourceDocument.DocumentDebugInfoReader.FindSourceDocuments(EntityHandle entityHandle) in /_/src/Features/Core/Portable/PdbSourceDocument/DocumentDebugInfoReader.cs:line 38
   at Microsoft.CodeAnalysis.PdbSourceDocument.PdbSourceDocumentMetadataAsSourceFileProvider.GetGeneratedFileAsync(MetadataAsSourceWorkspace metadataWorkspace, Workspace sourceWorkspace, Project sourceProject, ISymbol symbol, Boolean signaturesOnly, MetadataAsSourceOptions options, String tempPath, TelemetryMessage telemetryMessage, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/PdbSourceDocument/PdbSourceDocumentMetadataAsSourceFileProvider.cs:line 188
   at Microsoft.CodeAnalysis.MetadataAsSource.MetadataAsSourceFileService.GetGeneratedFileAsync(Workspace sourceWorkspace, Project sourceProject, ISymbol symbol, Boolean signaturesOnly, MetadataAsSourceOptions options, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/MetadataAsSource/MetadataAsSourceFileService.cs:line 108
   at Microsoft.CodeAnalysis.LanguageServer.Handler.AbstractGoToDefinitionHandler.GetDefinitionsAsync(IGlobalOptionService globalOptions, IMetadataAsSourceFileService metadataAsSourceFileService, Workspace workspace, Document document, Boolean typeOnly, LinePosition linePosition, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Definitions/AbstractGoToDefinitionHandler.cs:line 84
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
[Error - 3:34:50 AM] Request textDocument/definition failed.
  Message: Read out of bounds.
  Code: -32000
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 14, 2024
@just-ero
Copy link
Author

Other types in System.Net appear to be affected as well. The same happens on IPAddress, for example.

@amcasey
Copy link
Member

amcasey commented Sep 17, 2024

Just got this in my activity log

System.BadImageFormatException: Read out of bounds.
   at System.Reflection.Throw.OutOfBounds()
   at Microsoft.CodeAnalysis.PdbSourceDocument.DocumentDebugInfoReader.FindSourceDocuments(EntityHandle entityHandle)
   at Microsoft.CodeAnalysis.PdbSourceDocument.PdbSourceDocumentMetadataAsSourceFileProvider.<GetGeneratedFileAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.CodeAnalysis.MetadataAsSource.MetadataAsSourceFileService.<GetGeneratedFileAsync>d__9.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.VisualStudio.LanguageServices.Implementation.VisualStudioSymbolNavigationService.<GetNavigableLocationForMetadataAsync>d__8.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.VisualStudio.LanguageServices.Implementation.VisualStudioSymbolNavigationService.<GetNavigableLocationAsync>d__7.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.FindUsages.DefinitionItem.DefaultDefinitionItem.<GetNavigableLocationAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.CodeAnalysis.Editor.Host.IStreamingFindUsagesPresenterExtensions.<GetStreamingLocationAsync>d__1.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.Navigation.AbstractDefinitionLocationService.<>c__DisplayClass4_0.<<GetDefinitionLocationAsync>g__GetSymbolLocationAsync|2>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.Navigation.AbstractDefinitionLocationService.<>c__DisplayClass4_0.<<GetDefinitionLocationAsync>g__GetDefinitionLocationWorkerAsync|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.Navigation.AbstractDefinitionLocationService.<GetDefinitionLocationAsync>d__4.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.Editor.NavigableSymbols.NavigableSymbolService.NavigableSymbolSource.<GetNavigableSymbolAsync>d__5.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.VisualStudio.Text.Utilities.GuardedOperations.<CallExtensionPointAsync>d__41`1.MoveNext()

C# Tools 4.12.0-3.24458.2+bd5c00e5e09de8564093f42d87fe49d4971f2e84

@just-ero
Copy link
Author

I'm actually getting this same error in unrelated files as well, seemingly at random times.

@CyrusNajmabadi CyrusNajmabadi added this to the 17.13 milestone Nov 26, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged Issues and PRs which have not yet been triaged by a lead label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants