Skip to content

Handlers/services don't get ILanguageServer #436

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
mikkleini opened this issue Nov 23, 2020 · 1 comment
Closed

Handlers/services don't get ILanguageServer #436

mikkleini opened this issue Nov 23, 2020 · 1 comment

Comments

@mikkleini
Copy link

mikkleini commented Nov 23, 2020

I updated from 0.17.4 to 0.18.3 and run into issue. I have services and handlers which have ILanguageServer type of constructor arguments. But now I get error at start-up:

code: Error.UnableToResolveFromRegisteredServices;
message: Unable to resolve Resolution root ......TextDocumentSyncHandler
from container without scope
with Rules with................

I suspect it is the dependency injection thing. Breakpoints at constructors were not reached. I did some searching in the git log to find what changed, but I'm bit lost here. How could I fix it?
Maybe I was doing it some ugly way before and that way is shut now?
If so then I don't know how to call PublishDiagnosticsExtensions.PublishDiagnostics without having ILanguageServer reference available.


Way to reproduce: open SampleServer project, modify TextDocumentHandler constructor:

        public TextDocumentHandler(
            ILogger<TextDocumentHandler> logger, Foo foo,
            ILanguageServerConfiguration configuration,
            ILanguageServer server)  // Addition
        {
            server.Window.LogInfo("Hello"); // Not reached
            _logger = logger;
            _configuration = configuration;
            foo.SayFoo();
        }

Exception thrown in netstandard2.0\Dryloc\container.cs function It:

DryIoc.ContainerException: 'code: Error.UnableToResolveFromRegisteredServices;
message: Unable to resolve Resolution root TextDocumentHandler
from container without scope
with Rules with {TrackingDisposableTransients, ResolveIEnumerableAsLazyEnumerable, UseDynamicRegistrationsAsFallbackOnly, SelectLastRegisteredFactory} and without {ThrowOnRegisteringDisposableTransient, VariantGenericTypesInResolvedCollection}
with DefaultReuse=Scoped {Lifespan=100}
with FactorySelector=SelectLastRegisteredFactory
with Made={FactoryMethod=ConstructorWithResolvableArgumentsIncludingNonPublic}
with normal and dynamic registrations:
(DefaultDynamicKey(0), {FactoryID=151, ImplType=TextDocumentHandler, Reuse=TransientReuse, HasCondition})'

@mikkleini
Copy link
Author

Found what changed meanwhile: Issue #338 got fixed. Using ILanguageServerFacade solved it.

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

1 participant