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

Strange error when subscribing to unhandled notifications #6

Open
Kethku opened this issue Sep 15, 2019 · 5 comments
Open

Strange error when subscribing to unhandled notifications #6

Kethku opened this issue Sep 15, 2019 · 5 comments

Comments

@Kethku
Copy link

Kethku commented Sep 15, 2019

Error invoking 'poll' on channel 92:^@ch 92 sent an invalid message, closed

I get the above error when registering commands like so:

using System;
using System.IO;

using NvimClient.API;
using NvimClient.API.NvimPlugin.Attributes;
using NvimClient.API.NvimPlugin.Parameters;

namespace Suggestions {
    [NvimPlugin]
    public class SuggestionsPlugin {
        private readonly NvimAPI nvim;
        private StreamWriter log;


        public SuggestionsPlugin(NvimAPI nvim) {
            this.nvim = nvim;
            log = File.AppendText("./logs");

            this.nvim.OnUnhandledNotification += UnhandledNotification;
        }

        [NvimFunction]
        public async void Test() {
            var currentBuffer = await this.nvim.GetCurrentBuf();
            currentBuffer.Attach(true, null);
            this.nvim.OnUnhandledNotification += UnhandledNotification;
        }

        public void UnhandledNotification(object sender, NvimUnhandledNotificationEventArgs args) {
            log.WriteLine(args.MethodName);
        }
    }
}

Any ideas whats going on? Its hard to debug this without much in the way of documentation/examples.

@justinmk
Copy link
Member

I have neovim/neovim#8883 which should make the error more useful for this very reason. IIRC, the .net compiler is printing stuff to stdout or stderr, which obviously isn't valid msgpack.

Maybe it can be fixed by adjusting the dotnet invocations here: https://github.com/neovim/nvim.net/blob/23a123a/autoload/provider/dotnet.vim#L5-L12 (e.g. pass a --quiet arg or something like that)

@Kethku
Copy link
Author

Kethku commented Sep 16, 2019

I wonder if a better strategy might be to build the executable and run the built dll directly instead of building to run. It would improve startup time too. It would also give something to place in the rplugin folder instead of just leaving an empty one...

That said, I don't fully understand everything going on :)

@justinmk
Copy link
Member

That's quite possible. Help is certainly welcome...

@Kethku
Copy link
Author

Kethku commented Sep 16, 2019

I'd love to help. Is this the best place to ask questions as I investigate?

@justinmk
Copy link
Member

justinmk commented Sep 16, 2019

sure.

build the executable and run the built dll directly instead of building to run.

Maybe @b-r-o-c-k can comment on whether the current approach is intentional/required for some reason.

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