question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

More Events for Reloading

See original GitHub issue

Hello, I’m trying to build a Plugin System on top of your awesome Library. I currently have the following use cases:

  • Download & Start Plugins at runtime
  • Upgrade Plugins at runtime
  • Stop Plugins at runtime

while downloading, starting and stopping is actually working really nicely, reloading/upgrading has some caveheats.

currently I have uploaded a demo project at github here: https://github.com/schmitch/dotnet-plugin-demo

currently I need to have a Stop method called before reloading my plugin. Unfortunatly I can only call it after the plugin got reloaded.

That is my log output:

Current Time V4: 23.10.2019 12:04:50
Reload Triggered, EventArgs: McMaster.NETCore.Plugins.PluginLoader / McMaster.NETCore.Plugins.PluginLoader
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
Created plugin instance 'Timestamp Plugin V5'.
Current Time V5: 23.10.2019 12:04:52

How it should be:

Current Time V4: 23.10.2019 12:04:50
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
Reload Triggered, EventArgs: McMaster.NETCore.Plugins.PluginLoader / McMaster.NETCore.Plugins.PluginLoader
Created plugin instance 'Timestamp Plugin V5'.
Current Time V5: 23.10.2019 12:04:52

Currently I think it would be possible by introducing an event that will be called, before this._context.Unload(); is called. Maybe call it BeforeReload (i.e. Reloaded could also be deprecated in favor of AfterReload, then)?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dazinatorcommented, Aug 28, 2020

In terms of cleanup how about this:

  1. As Reload is a public method, you could set up your own file watcher / event to call it, but before you do call Reload, do your “cleanup”. This could take the form:

A) Make sure you call Dispose() on any disposable instances loaded from that assy load context. This is easier if for example you have a DI container responsible for the lifetime of all those types, and then you can just Dispose() that container.

1reaction
sgfcommented, Nov 11, 2021
  1. As Reload is a public method, you could set up your own file watcher / event to call it, but before you do call Reload, do your “cleanup”. This could take the form:

u are right,i do own file watcher and call the Reload now. thanks for share your idea.

Read more comments on GitHub >

github_iconTop Results From Across the Web

So apparently reloading a game gives me a bunch of ...
So apparently reloading a game gives me a bunch of random events, changes my relegion, takes decisions for me and changes my ruler?...
Read more >
Event outcome is predetermined? - Paradox Interactive Forums
Ruler dies... reload multiple times (around 20), same result with only 30% chance, even let the game run a few days and tick...
Read more >
[#10] Weapon Reloading using animation events in unity
This video demonstrates how to add reloading to your character using animation events. There are 4 animations events, detach, drop, refill, ...
Read more >
Page reload in Chrome unnecessarily triggers bound ...
When I refresh page two more are quickly output, and instantly after that two more (from new page view). If I instead just...
Read more >
Events reset to original spot when reloading a game
So I have been getting this issue with my events. ... Use multiple events and use switches (and/or variables) to determine which one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found