Note: This issue is not duplicate despite the title reads similarly.
The following upstream signalR trigger function has been working well until we upgraded the NuGet packages to the latest versions.
[Function("OnConnected")]
[SignalROutput(HubName = "myhub")]
public async Task<SignalRMessageAction> OnConnectedAsync([SignalRTrigger("myhub", "connections", "connected")] SignalRInvocationContext invocationContext)
{
// do some stuff
return new(target!)
{
ConnectionId = invocationContext.ConnectionId,
Arguments = new object[] { "something" }
};
}
The issue is that we started getting the following runtime exception:
Microsoft.Azure.WebJobs.Host: Error indexing method ‘Functions.OnConnected’. Microsoft.Azure.SignalR.Management: Could not load file or assembly ‘Microsoft.Extensions.Options, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’. The system cannot find the file specified.
We inspected the NuGet package references and found that we are not referencing Microsoft.Azure.SignalR.Management in our packages list.
Repro steps
Create an upstream signalR function in a .NET 7.0 dotnet-isolated v4 function app and add the following NuGet packages:
<PackageVersion Include="Microsoft.Azure.Functions.Worker" Version="1.14.1" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.10.0" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.SignalRService" Version="1.10.0" />
The dotnet version is 7.0.304
What is the workaround or fix for this roadblock?
2
Answers
This issue will be fixed once Microsoft addresses this GitHub issue.
At this moment, I had to downgrade the NuGet packages.
This error could be because of the upgradation of .NET version to 7.0.
To resolve this issue:
Need to check if all the installed dependencies version compatible with the .NET version. It can be checked in nuget.org.
Upgrade the package versions to its latest version which are compatible with the application’s .NET version.
Also check by Installing the below nuget packages through Nuget Package Manager:
.csproj:
References:
Refer to similar Github code given by Y-Sindo.