-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Now that I've downloaded the latest binaries from Nuget, I see I bumped the same issue @ReubenBond mentioned here: Orleans does not respect binding redirects. I should have paid more attention to that, sorry for being slow with this. :)
I see AssemblyLoader makes use of Assembly.ReflectionOnlyLoadFrom at line 277 and I suspect this is the reason (without actually debugging). According to the documentation this does not respect binding redirects. It would look like one needs to use AppDomain.ApplyPolicy to get this behavior. The fix would be simply following:
pathName = AppDomain.CurrentDomain.ApplyPolicy(pathName); //This line is added as a fix.
assembly = Assembly.ReflectionOnlyLoadFrom(pathName); //And from here onwards it'd be as it were.
Currently the Nuget packages are marked to indicate either the packages Orleans references or newer are accepted, so this looks like a rather nasty bug. There are two solutions:
- Fix Nuget specification so that only exact versions are allowed.
- Allow applying policies.
<edit: I see there's also Assembly.LoadFile used in AssemblyLoader. I'm not sure if it respects redirects, but probably no harm would be done if policies would be applied.
<edit 2: All right, this little fix may not work. I hunt down one prominent example:
[XRE Runtime issue #563 (line 178)](aspnet/dnx#563)
And discussion touching this very issue at XRE #819.
<edit 3: And it looks like the version specification has a bug too: https://docs.nuget.org/create/versioning, and elaboration: http://weblog.west-wind.com/posts/2014/Jun/19/Nuget-Dependencies-and-latest-Versions and even more elaboration http://docs.nuget.org/release-notes/nuget-2.8 (it looks like this changes from release to release :)). The best fix, I suppose, would be to fix the version specification and the reflection loading bits (if there's a bug there, it's still somewhat a hypotesis, but I'm travelling at the moment).
Absent of better information, I'd take 2). I can supply the PR, but unfortunately I wasn't able to generate the Nuget packages and test my fix. The error messages was
C:\projektit\orleans\src\nuget> .\CreateOrleansPackages.bat C:\projektit\Orleans\Binaries\Release C: \projektit\Orleans\Binaries\Release\Version.txt CreateOrleansNugetPackages running in directory = C:\projektit\orleans\src\nuget CreateOrleansNugetPackages version file = C:\projektit\Orleans\Binaries\Release\Version.txt from base dir = using nuget location = C:\projektit\Orleans\src\NuGet\..\.nuget\nuget.exe Using binary drop location directory C:\projektit\Orleans\Binaries\Release Using version number from file C:\projektit\Orleans\Binaries\Release\Version.txt CreateOrleansNugetPackages: Version = 1.0.3 -- Drop location = C:\projektit\Orleans\Binaries\Release Attempting to build package from 'Microsoft.Orleans.Client.nuspec'. System.IO.FileNotFoundException: File not found: 'ClientInstall.ps1'. kohteessa NuGet.PackageBuilder.AddFiles(String basePath, String source, String destination, String exclude) kohteessa NuGet.PackageBuilder.PopulateFiles(String basePath, IEnumerable`1 files) kohteessa NuGet.PackageBuilder.ReadManifest(Stream stream, String basePath, IPropertyProvider propertyProvider) kohteessa NuGet.PackageBuilder..ctor(String path, String basePath, IPropertyProvider propertyProvider, Boolean includ eEmptyDirectories) kohteessa NuGet.Commands.PackCommand.CreatePackageBuilderFromNuspec(String path) kohteessa NuGet.Commands.PackCommand.BuildFromNuspec(String path) kohteessa NuGet.Commands.PackCommand.BuildPackage(String path) kohteessa NuGet.Commands.PackCommand.ExecuteCommand() kohteessa NuGet.Commands.Command.Execute() kohteessa NuGet.Program.Main(String[] args)