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

AddOpenCodeFixProvider throws for types with attributes in implicit top-level modules #15993

Closed
Tracked by #15408
psfinaki opened this issue Sep 18, 2023 · 0 comments · Fixed by #15998
Closed
Tracked by #15408
Assignees
Labels
Area-LangService-CodeFixes Code fixes associated with diagnostics Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.

Comments

@psfinaki
Copy link
Member

This code throws:

[<SomeAttribute>]
type MyType() =
    inherit Type ()

Stack trace:

System.Collections.Generic.KeyNotFoundException : An index satisfying the predicate was not found in the collection.
   at Microsoft.FSharp.Collections.SeqModule.loop@1146-22[T](FSharpFunc`2 predicate,IEnumerator`1 ie,Int32 i)
   at Microsoft.FSharp.Collections.SeqModule.FindIndex[T](FSharpFunc`2 predicate,IEnumerable`1 source)
   at Microsoft.VisualStudio.FSharp.Editor.AddOpenCodeFixProvider.getOpenDeclaration(SourceText sourceText,InsertionContext ctx,String ns)
   at Microsoft.VisualStudio.FSharp.Editor.AddOpenCodeFixProvider.openNamespaceFix(InsertionContext ctx,String name,String ns,Boolean multipleNames,SourceText sourceText)
   at <StartupCode$FSharp-Editor>.$AddOpenCodeFixProvider.clo@115-153.Invoke(Tuple`4 tupledArg)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.map@128.DoMoveNext(b& curr)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System.Collections.IEnumerator.MoveNext()
   at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeInner@312[T,TResult](ConcatEnumerator`2 x,Unit unitVar0)
   at Microsoft.FSharp.Collections.SeqModule.TryHead[T](IEnumerable`1 source)
   at async StartupCode$FSharp-Editor(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.VisualStudio.FSharp.Editor.CodeFixExtensions.CodeFixContext-RegisterFsharpFix@108(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.CodeAnalysis.CodeFixes.CodeFixService.GetCodeFixesAsync(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameters>)
@psfinaki psfinaki added Bug Area-LangService-CodeFixes Code fixes associated with diagnostics Needs-Triage labels Sep 18, 2023
@github-actions github-actions bot added this to the Backlog milestone Sep 18, 2023
@psfinaki psfinaki mentioned this issue Sep 18, 2023
85 tasks
@0101 0101 added Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. and removed Needs-Triage labels Sep 18, 2023
@psfinaki psfinaki changed the title AddOpenCodeFixProvider throws for some special type/attribute pairs AddOpenCodeFixProvider throws for types with attributes in implicit top-level modules Sep 18, 2023
@psfinaki psfinaki self-assigned this Sep 18, 2023
@psfinaki psfinaki modified the milestones: Backlog, September-2023 Sep 18, 2023
@github-project-automation github-project-automation bot moved this from Not Planned to Done in F# Compiler and Tooling Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-CodeFixes Code fixes associated with diagnostics Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants