System.ArgumentNullException: Value cannot be null. (Parameter 'path1')
at System.IO.Path.Combine(String path1, String path2)
at Unosquare.WiringPi.Resources.EmbeddedResources.ExtractAll()
at Unosquare.WiringPi.BootstrapWiringPi.Bootstrap()
at Unosquare.RaspberryIO.Pi.Init[T]()
at HorseFeeder.Raspberry.InitializeService.InitializeRaspberryPi()
Since .NET 5 the
Assembly.Location
API returns an empty string when the app is deployed as single file executable. https://docs.microsoft.com/en-us/dotnet/core/deploying/single-fileThis prevents the library from using with a single file deployment.
Error The
basePath
variable will be empty. https://github.com/unosquare/wiringpi-dotnet/blob/9746619117ab82ca16d80b51de0d4a67839e81c9/src/Unosquare.WiringPi/Resources/EmbeddedResources.cs#L36Path.Combine
later on will throw an exception. https://github.com/unosquare/wiringpi-dotnet/blob/9746619117ab82ca16d80b51de0d4a67839e81c9/src/Unosquare.WiringPi/Resources/EmbeddedResources.cs#L42Exception
Possible solution I'm not 100% sure but maybe it's possible to use
AppContext.BaseDirectory
to get thebasePath
. https://docs.microsoft.com/en-us/dotnet/api/system.appcontext.basedirectory?view=net-5.0#System_AppContext_BaseDirectory