azure-webjobs-sdk icon indicating copy to clipboard operation
azure-webjobs-sdk copied to clipboard

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

Open Arash-Sabet opened this issue 1 year ago • 8 comments

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

Arash-Sabet avatar Jun 26 '23 10:06 Arash-Sabet

@pragnagopa Any inputs on this issue as it has become a roadblock? Thanks.

Arash-Sabet avatar Jun 26 '23 13:06 Arash-Sabet

@Y-Sindo would you be able to chime in and possibly let me know what can be wrong? Thanks.

Arash-Sabet avatar Jun 28 '23 03:06 Arash-Sabet

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

Y-Sindo avatar Jun 28 '23 12:06 Y-Sindo

@Y-Sindo The recent NuGet updates from last night/yesterday did not solve the issue either.

Arash-Sabet avatar Jun 28 '23 15:06 Arash-Sabet

@Y-Sindo Just captured a screenshot:

image

Arash-Sabet avatar Jun 28 '23 18:06 Arash-Sabet

@Y-Sindo Just wondering, any updates on this issue?

Arash-Sabet avatar Jun 30 '23 11:06 Arash-Sabet

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 .

Y-Sindo avatar Jun 30 '23 12:06 Y-Sindo

Hope there will be a fix for this roadblock soon. Thanks for looking into it @Y-Sindo .

Arash-Sabet avatar Jun 30 '23 13:06 Arash-Sabet