question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Started getting Microsoft.Azure.SignalR.Management: Could not load file or assembly Microsoft.Extensions.Options after upgrading to the latest NuGet packages

See original GitHub issue

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" />

Expected behavior

The mentioned exception should not happen.

Actual behavior

The following exception happens:

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.

Known workarounds

Unknown

Related information

Provide any related information

The dotnet version is 7.0.304

Issue Analytics

  • State:open
  • Created 3 months ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Y-Sindocommented, Jun 30, 2023

I believe the issue is caused by the target framework changes since Microsoft.Azure.SignalR and Microsoft.Azure.Common 1.15.1 . where .NET 6.0 and .NET 7.0 are added as target frameworks of those two packages and somehow changed the dependency resolution process on .NET 7.0.

I’m trying to figure out whether this only occurs in .NET isolated worker runtime or if it’s a common behavior on .NET 7.0 .

1reaction
Y-Sindocommented, Jun 28, 2023

@Arash-Sabet Thanks for reporting the issue. I’m still investigating now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upstream Azure SignalR function issues Could not load file ...
The following upstream signalR trigger function has been working well until we upgraded the NuGet packages to the latest versions. The issue is ......
Read more >
how to fix : Could not load file or assembly 'Azure.Core'
I have a .net framework 4.2 Test Project, which calls methods in .net 4.2 a class library called Interface. Interface references another ...
Read more >
Azure Function and Entity Framework Sql Server error
I found this error to be reproducible. Create a new HTTP Trigger Azure Function, .NET 6. Add the below class to create a...
Read more >
Microsoft.Azure.WebJobs.Extensions.SignalRService 1.11.0
This extension provides functionality for accessing Azure SignalR Service from an Azure Function. Getting started. Install the package. Install the SignalR ...
Read more >
Microsoft signalr documentation. AspNetCore. services. It should
Hosting SignalR in an Azure Worker Role might result in the exception "Could not load file or assembly 'Microsoft. C#. Once your triggers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found