Getting exceptions when running basic orleans application - c#

I'm involved in a IoT project and considering orleans as a platform. I tried to do the basic tutorial here:
http://dotnet.github.io/orleans/Step-by-step-Tutorials/Minimal-Orleans-Application
It seems to be working but I'm getting the following exceptions in the console which would be nice to get rid of:
Could not load file or assembly 'OrleansCodeGenerator' or one of its
dependencies. The system cannot find the file specified. Exception =
System.IO.FileNotFoundException: Could not load file or assembly
'OrleansCodeGenerator' or one of its dependencies. The system cannot
find the file specified.
Could not load file or assembly
'Microsoft.Extensions.DependencyInjection.Abstractions,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or
one of its dependencies. The system cannot find the file specified.
I'm using orleans version 1.1.0

This is a know issue on the template packages. Could you please add the Nuget Microsoft.Extensions.DependencyInjection.Abstractions version 1.0.0-rc1-final on the Silo host Project? For the other exception, looks like are missing the OrleansCodegenerator package. Could you please ensure that .Server nuget is on Silo Host, .Client on Client/FrontEnd and .Core in Interfaces/Grain project? I think it will work otherwise, feel free to open an issue on https://github.com/dotnet/orleans and we will have a look.
More info
The reason this dependency is not added by default as a OrleansCodegenerator dependency, is that this package is not published as a stable package (it is marked as pre-release) and we can't have pre-release packages on Orleans packages otherwise, we would must release Orleans packages as -pre packages. As soon as this package is published as release we are going to update Orleans packages to contain it.

Related

Is there a way to create a NuGet package that allows for its dependencies to be upgraded?

Last year, I created a NuGet package that contained a single DLL and has a single dependency on the DocumentFormat.OpenXml NuGet project version 2.5.0. Since then, the DocumentFormat.OpenXml has been upgraded. If someone tries to upgrade DocumentFormat.OpenXml to the latest version, my code will throw the following error:
Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The located assembly's manifest definition does not match
the assembly reference. (Exception from HRESULT: 0x80131040)
I've tried setting my project's AutoGenerateBindingRedirects to true and setting the dll's "Specific Version" to false, but neither helps the user of the my NuGet package. Yes, they could put in a bindingRedirect in their configuration file and manually tell it to use something else or run the PM command (Get-Project –All | Add-BindingRedirect), but I was trying to find a way of automating this so that they user doesn't have to deal with it.
If you go to the NuGet site, they invest a lot of time talking about how to adjust your NuSpec file to allow for different versions, but I cannot find any guidance on how to actually make your code accept multiple versions OR how to create the bindingRedirect for the user automatically.

How do I reference a "Portable" .NET assembly from an Azure Cloud Function?

I've successfully referenced an assembly via Nuget and project.json that is a "Portable" assembly. All my code compiles in the Azure function, but when it's run I get:
Could not load file or assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The system cannot find the file specified.
As I understand it this is the portable version of System.Net, and Azure only preinstalls the 4.6 version of System.Net.
How do I work around this?
This is caused by a bug that has been addressed on the current Azure Functions host milestone and will be deployed with the next release (likely towards the end of the week). You can find more information about the issue and the fix here: https://github.com/Azure/azure-webjobs-sdk-script/issues/478
In the meantime, a workaround would be to copy System.Net from the Framework folder into a bin folder, inside of your function's folder. The host will automatically resolve it as a private assembly.

Getting a "Could not load file or assembly" although it should be there

I'm working on an Azure Function that uses a couple of nuget packages to decode Json web tokens.
I've referenced System.IdentityModel.Tokens.Jwt and Microsoft.IdentityModel.Protocol.Extensions in the project.json and it compiles fine.
I'm able to use classes and methods from System.IdentityModel.Tokens.Jwt but it appears that Microsoft.IdentityModel.Protocol.Extensions cannot see the assembly.
"One or more errors occurred. Microsoft.IdentityModel.Protocol.Extensions: Could not load file or assembly 'System.IdentityModel.Tokens.Jwt, Version=4.0.20622.1351, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."
I double checked the dependencies from the nuget package source and in Kudu to ensure they are present.
I'm a bit stuck as to what to investigate next!
Cheers,
Jordan.

FileLoadException - Could not load file or assembly

All of a suddon, I'm getting a FileLoadException when getting an instance of a class from Ninject.
The exact exception is the following:
System.IO.FileLoadException: "Could not load file or assembly 'Quartz, Version=2.3.3.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
When reading the error message, it seems quite clear that it tries to load an assembly of Quartz with version 2.3.3.0 but the specified version is another... but I don't get why it even loads version 2.3.3.0.
I searched the whole solution (inclusive the .csproj) for Quartz references and every reference states v1.0.1.2.
I've searched the path on the file system for Quartz.dlls but could only find dlls of version 1.0.1.2 so I don't understand why it tries to load 2.3.3.0.
Do you know of any steps I could try to solve this exception?
Thanks in advance
Check the class library that includes Quartz. Make sure that the platform version is consistent. You can do this by right clicking on the project file and selecting properties. Then check the assembly version in the first/top most tab.
Whatever platform version you have in that class library should be consistent with the other projects in the solution.
This happens when you install some other nuget package (like Quartz.Unity) which depends on Quartz. While installing that other package if you select 'lowest' option for dependency then it would set Quartz 2.3.3.0 as dependency. However, you have Quartz 2.4.1 installed in your package. So you get the error.
Solution: While installing that other package select 'highest' option for dependency if you have highest version installed in your project.

Missing Dependency: Castle.DynamicProxy2 after install LINQtoExecl from NuGet

I recently added the package LinqToExcel to my .net 4 WPF project and now when entering the designer I am presented with the following error:
System.IO.FileNotFoundException
Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The system cannot find the file specified.
LinqToExcel only has one dependency - log4net, which it installed as part of the NuGet process. Both are referenced and set to Copy Local. I'm not sure where the reference to Castle is coming from or how to go about fixing it.
Does anyone have any suggestions?

Categories

Resources