Dreamescaper / IntelliSenseExtender

GNU General Public License v3.0
88 stars 17 forks source link

When I new an object that does not introduce a namespace, this exception is thrown #66

Closed netcore-jroger closed 4 years ago

netcore-jroger commented 4 years ago

VS Version: 16.6.0 Preview 3.0

  <entry>
    <record>2788</record>
    <time>2020/04/22 07:07:10.226</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.TypeInitializationException: The type initializer for &apos;IntelliSenseExtender.ExposedInternals.GenerationOptions&apos; threw an exception. ---&gt; System.InvalidCastException: Unable to cast object of type &apos;Microsoft.CodeAnalysis.Options.PerLanguageOption2`1[System.Boolean]&apos; to type &apos;Microsoft.CodeAnalysis.Options.PerLanguageOption`1[System.Boolean]&apos;.&#x000D;&#x000A;   at IntelliSenseExtender.ExposedInternals.GenerationOptions..cctor()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)&#x000D;&#x000A;   --- End of inner exception stack trace ---&#x000D;&#x000A;   at IntelliSenseExtender.Editor.NamespaceResolver.&lt;AddNamespaceImportAsync&gt;d__0.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at IntelliSenseExtender.IntelliSense.CompletionCommitHelper.&lt;GetChangeAsync&gt;d__1.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Completion.CompletionServiceWithProviders.&lt;GetChangeAsync&gt;d__36.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Roslyn.Utilities.TaskExtensions.WaitAndGetResult_CanCallOnBackground[T](Task`1 task, CancellationToken cancellationToken)&#x000D;&#x000A;   at Roslyn.Utilities.TaskExtensions.WaitAndGetResult[T](Task`1 task, CancellationToken cancellationToken)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.AsyncCompletion.CommitManager.Commit(Document document, CompletionService completionService, ITextView view, ITextBuffer subjectBuffer, CompletionItem roslynItem, TextSpan completionListSpan, Nullable`1 commitCharacter, ITextSnapshot triggerSnapshot, CompletionRules rules, String filterText, CancellationToken cancellationToken)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.AsyncCompletion.CommitManager.TryCommit(IAsyncCompletionSession session, ITextBuffer subjectBuffer, CompletionItem item, Char typeChar, CancellationToken cancellationToken)&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Implementation.AsyncCompletionSession.&lt;&gt;c__DisplayClass83_1.&lt;CommitItem&gt;b__1()&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint[T](Object errorSource, Func`1 call, T valueOnThrow, Predicate`1 exceptionToIgnore, Predicate`1 exceptionToHandle)</description>
  </entry>
netcore-jroger commented 4 years ago

@Dreamescaper I found you fix an issue with 16.6 P3, how can I find the latest vsix file?

Dreamescaper commented 4 years ago

Yeah, I fixed this issue, but haven't published to marketplace. Could you test this and let me know whether everything's fine? https://ci.appveyor.com/api/buildjobs/j02c2q4m7gx4yrty/artifacts/IntelliSenseExtender%2Fbin%2FRelease%2Fnet472%2FIntelliSenseExtender.vsix

netcore-jroger commented 4 years ago

Ok 😃

netcore-jroger commented 4 years ago

@Dreamescaper Great, it work fine.

netcore-jroger commented 4 years ago

@Dreamescaper But he does not seem to list all available classes. such as System.IO image

netcore-jroger commented 4 years ago

Strange, just tried it again, it's ok again. image

netcore-jroger commented 4 years ago

I think it should be that the index has not been completed.

Dreamescaper commented 4 years ago

Yes. I removed support for unimported types and extension methods, since this functionality is available in VS itself now. Let me know if there's any issues with that approach.

And native completion works exactly like that - if index is not populated, it shows completion dialog without unimported types in order not to block typing.

netcore-jroger commented 4 years ago

Okay, if there are any questions, I will ask you at the first time.