Jump to content

Debugging plugins


Recommended Posts

BillOatman
Posted

Hi.  In the dev doc for plugins it says

The quickest way to test code changes is to work without the debugger. 

It seems to be advocating debugging via log statements?  Does [remote] debugging with visual studio work?

Posted

I find that to be the easiest but @@softworkz may have some tips.

Posted

Hi.  In the dev doc for plugins it says

The quickest way to test code changes is to work without the debugger. 

It seems to be advocating debugging via log statements?  Does [remote] debugging with visual studio work?

 

I can't explain the sentence you quoted, but:

 

Generally, remote debugging should work in most situations. I've even been able to remote-debug Emby Server while it was running on a Linux machine(!!).

 

Also, you can of course attach to an Emby process running locally.

 

 

But the most convenient approach is to configure Visual Studio in a way that you simply need to hit F5 or click the green-arrow button.

 

To do this, you need to set up two things:

  1. Create a post-build step that automatically copies your plugin dll and the .pdb file to the plugins folder of a local Emby Server installation.

    (I can't send you a sample script for this because we're using an MSBuild task that wouldn't work in your case)

    .

  2. Modify your plugin-project's Debug settings to "Launch an Executable" and configure it to start Emby Server. (also set the working folder)

Hope this helps...

BillOatman
Posted (edited)

Yup thanks, I tried it last night with the remote debugger and the hue plugin source (I put the dll and pdb files on the server).  The breakpoints never went active even when i started/stopped a movie (which it should have), but I am also not seeing any info log output which makes me think it isn't really running.  The plugin author is releasing new source this week so hopefully I will have better luck with it.

 

Thanks for the the input and confirmation.

 

Actually, where should I be putting the plugin dll and pdb files on my windows 10 Emby server machine if I want to test them?  Maybe that's my problem.  

Edited by BillOatman
Posted

  1. Create a post-build step that automatically copies your plugin dll and the .pdb file to the plugins folder of a local Emby Server installation.

BillOatman
Posted (edited)

Yeah I didn't think I'd get that lucky.

 

I built the existing hue plugin and added this logging just to see if it was running at all.  The log shows that the plugin was loaded, but I get no info messages in the log at all.  Is there anything else that needs to be done?

 

   public class HueControl : IServerEntryPoint

public HueControl(ISessionManager sessionManager, IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogManager logManager, IUserDataManager userDataManager, ILibraryManager libraryManager)
        {
           _logger = logManager.GetLogger(Plugin.Instance.Name);
            _libraryManager = libraryManager;
            _sessionManager = sessionManager;
            _userDataManager = userDataManager;
            _httpClient = httpClient;
            _jsonSerializer = jsonSerializer;


            Instance = this;
        }


 public void Run()
        {
            _logger.Info("Got to Run()");


            _sessionManager.PlaybackStart += PlaybackStart;
            _sessionManager.PlaybackStopped += PlaybackStopped;
            _sessionManager.PlaybackProgress += PlaybackProgress;


            //_libraryManager.ItemAdded += ItemAdded;
        }


      private void PlaybackStart(object sender, PlaybackProgressEventArgs e)
        {
            _logger.Info("***** PlaybackStart *****");
Edited by BillOatman

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...