-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugSomething isn't workingSomething isn't working
Description
orion-launcher/src/Orion.Launcher/Program.cs
Lines 103 to 109 in bf002ab
| foreach (var path in Directory.EnumerateFiles("plugins", "*.dll")) | |
| { | |
| try | |
| { | |
| var assembly = Assembly.LoadFile(path); | |
| server.Load(assembly); | |
| } |
The above snippet is bound to throw an exception. Assume the following structure:
logs/
plugins/
orion-launcher.exe
When called with a relative path (such as the above snippet), Directory.EnumerateFiles will return a collection of file names with their relative paths. Since Assembly.LoadFile requires an absolute path to load the assembly we're left with an unhandled argument exception.
There are 2 ways we could go about fixing this:
- Keep
Assembly.LoadFileand pass in an absolute path obtained via aPath.GetFullPathcall - Replace
Assembly.LoadFilewithAssembly.LoadFromwhich accepts a relative URI as well as an absolute one. This yields additional benefits such as hinting the runtime where to load dependencies from
Both solutions are one-liners.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working