You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.LoadFile and pass in an absolute path obtained via a Path.GetFullPath call
Replace Assembly.LoadFile with Assembly.LoadFrom which 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.
The text was updated successfully, but these errors were encountered:
orion-launcher/src/Orion.Launcher/Program.cs
Lines 103 to 109 in bf002ab
The above snippet is bound to throw an exception. Assume the following structure:
When called with a relative path (such as the above snippet),
Directory.EnumerateFiles
will return a collection of file names with their relative paths. SinceAssembly.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:
Assembly.LoadFile
and pass in an absolute path obtained via aPath.GetFullPath
callAssembly.LoadFile
withAssembly.LoadFrom
which accepts a relative URI as well as an absolute one. This yields additional benefits such as hinting the runtime where to load dependencies fromBoth solutions are one-liners.
The text was updated successfully, but these errors were encountered: