Skip to content

InvalidOperationException in integration test with LanguageClient using SemanticTokens #516

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

Closed
anthony-c-martin opened this issue Feb 6, 2021 · 3 comments

Comments

@anthony-c-martin
Copy link

I'm trying to add an integration test for semantic tokens to our codebase, but I'm hitting a cryptic exception on the semantic tokens request I make from client -> server:

Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll: 'Sequence contains no elements.'
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Bicep.LangServer.IntegrationTests.SemanticTokenTests.<Duplicate_tokens_are_not_returned>d__4.MoveNext() in /Users/ant/Code/bicep/src/Bicep.LangServer.IntegrationTests/SemanticTokenTests.cs:line 32

This is the PR I'm trying to introduce this test with: https://github.com/Azure/bicep/pull/1485/files - the test is under SemanticTokenTests.cs.

I'm not doing anything fancy to initialize the LanguageClient (init code here), and we use this same mechanism to test out various other language server features. I'm wondering if there's perhaps some mechanism to register capabilities that I'm missing?

Any pointers would be very helpful!

@david-driscoll
Copy link
Member

@anthony-c-martin sorry I didn't see this before. I'll take a look, sounds like a Single call

@anthony-c-martin
Copy link
Author

anthony-c-martin commented Mar 11, 2021

@anthony-c-martin sorry I didn't see this before. I'll take a look, sounds like a Single call

I've spent a while debugging this, but I'm unfortunately not at all familiar with the System.Reactive library being used. I couldn't find anything indicating the exception was occurring in our code, as I was able to step through the handler logic with "break on all exceptions" - and this is the only exception thrown.

Unfortunately the above stack trace doesn't give me any clues - it seems like this is occurring deep inside the omnisharp/reactive code, but all the originating call site information is being lost (I believe somewhat related to dotnet/reactive#1235).

@anthony-c-martin
Copy link
Author

The upgrade to 0.19 containing the fix for #556 also seems to have resolved this issue. Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants