Azure / azure-functions-signalrservice-extension

Azure Functions bindings for SignalR Service. Project moved to https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/signalr/Microsoft.Azure.WebJobs.Extensions.SignalRService .
MIT License
97 stars 48 forks source link

.Net 6 package issue #280

Closed chull434 closed 2 years ago

chull434 commented 2 years ago

Hi,

Ran into a package versioning issue after upgrading to net6.0 and azure functions v4

Got the following error:

Detected package downgrade: Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson from 5.0.1 to 3.0.0. Reference the package directly from the project to select a different version. 
Functions -> Microsoft.Azure.WebJobs.Extensions.SignalRService 1.6.0 -> Microsoft.Azure.SignalR.Management 1.11.0 -> Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (>= 5.0.1) 
Functions -> Microsoft.Azure.WebJobs.Extensions.SignalRService 1.6.0 -> Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (>= 3.0.0)

Adding the package Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson 6.0.0 fixed the error

Gimly commented 2 years ago

Did you manage to publish and make your function work afterward? Because I have issues with dependencies version mismatch on other packages one added the project as you proposed.

Y-Sindo commented 2 years ago

@chull434 Will fix in the later version.

Y-Sindo commented 2 years ago

@Gimly Could you show us the detailed dependency version mismatch errors?

Gimly commented 2 years ago

@Y-Sindo Here's the error that we get when running the application in our function host in Azure after fixing the Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson package as @chull434 suggested.

Microsoft.Extensions.Azure: Could not load file or assembly 'System.Diagnostics.Tracing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
chull434 commented 2 years ago

@Y-Sindo Here's the error that we get when running the application in our function host in Azure after fixing the Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson package as @chull434 suggested.

Microsoft.Extensions.Azure: Could not load file or assembly 'System.Diagnostics.Tracing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

yeah azure functions loves to drop random packages during deployment, we set <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput> on all are functions projects now

<PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
Y-Sindo commented 2 years ago

@Gimly Do you try the solution from @chull434 ?

adamholthaus50 commented 2 years ago

Are there plans to make this compatible with .Net 6.0 or this being deprecated? We have ran into this error as well.

Y-Sindo commented 2 years ago

Are there plans to make this compatible with .Net 6.0 or this being deprecated? We have ran into this error as well.

@adamholthaus50 This is not deprecated. We have moved the code to a mono repo and here is the address of the new location. We do have plans to support .NET 6. It might be in v1.7.0 or v1.8.0 version.

We will mark this repo as archived soon.

Please let us know if you cannot mitigate the error with @chull434 's solution.

ilcos91 commented 2 years ago

Any news on this? I have the .NET 6 update blocked in a branch since I cannot solve this error.

Y-Sindo commented 2 years ago

@ilcos91 What's the error you cannot resolve? You might want to share with us and we could see if we could mitigate it.

As SignalR extension project has been moved to Azure dotnet SDK repo, and that repo is still using .NET 5 SDK, we don't have a quick solution to remove the dependency conflict for .NET 6. We are working on removing the dependency of Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson package, but it needs more time.

ilcos91 commented 2 years ago

This is the error I get: Detected package downgrade: Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson from 5.0.1 to 3.0.0. Reference the package directly from the project to select a different version. Axylog.Azure.SignalR -> Microsoft.Azure.WebJobs.Extensions.SignalRService 1.6.0 -> Microsoft.Azure.SignalR.Management 1.11.0 -> Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (>= 5.0.1) Axylog.Azure.SignalR -> Microsoft.Azure.WebJobs.Extensions.SignalRService 1.6.0 -> Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (>= 3.0.0)

Y-Sindo commented 2 years ago

@ilcos91 Do you try to add a package reference suggested by the error message like this: <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="5.0.1)" />?

I am also a little bit curious why you are using Microsoft.Azure.WebJobs.Extensions.SignalRService on .NET 5 as in-process function model only supports .NET Core 3.1 and .NET 6. If you want to use in-process model, you should update the target framework to .NET 6; if you want to use out-of-process model, you should use Microsoft.Azure.Functions.Worker.Extensions.SignalRService, see Differences with .NET class library functions.

longtimedeveloper commented 2 years ago

@Y-Sindo I'm having the same issues also.

UPDATE: I'm going to build my app using .NET 3.1 so that I'm no longer blocked. When the next stable release of this awesome SignalR package is released, I'll upgrade to .NET 6.

  1. I need SignalR in my new .NET 6 Azure application. I can write it using .NET Core 3.1 but didn't want the hassle of porting it next year so I decided to write it using Azure .NET 6.

  2. Do you have a time frame of when this will work with .NET 6?

I did try adding, <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="5.0.1)" /> but it caused all my NuGet packages to disappear; so I had to reinstall them all using the VS UI.

Thank you!@

Error NU1605 Detected package downgrade: Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson from 5.0.1 to 3.0.0. Reference the package directly from the project to select a different version. 

 MolenatorGames -> Microsoft.Azure.WebJobs.Extensions.SignalRService 1.6.0 -> Microsoft.Azure.SignalR.Management 1.11.0 -> Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (>= 5.0.1) 
 MolenatorGames -> Microsoft.Azure.WebJobs.Extensions.SignalRService 1.6.0 -> Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (>= 3.0.0)  
Y-Sindo commented 2 years ago

@longtimedeveloper @ilcos91 Sorry, the line is in bad format. <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="5.0.1)" />

The right one should be : <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="5.0.1" />

For the time frame, the fix is completed but we are waiting for the release. As the repo has been moved to Azure/azure-sdk-for-net, we will follow the unified Azure .NET SDK release schedule. The next release is on 7th, December. We might not catch up with the release. The next next release is on 4th, January, 2022. We might release a beta version first. Hopefully, we can get approval to release a GA version at that time.

longtimedeveloper commented 2 years ago

@Y-Sindo thank you very much! Merry Christmas and Happy New Year!

Y-Sindo commented 2 years ago

Fortunately, we have managed to release 1.7.0-beta.1 version which fixes the package issue. Please have a try.

longtimedeveloper commented 2 years ago

@Y-Sindo created a fresh Visual Studio Azure Functions project targetting .NET 6.0. Worked perfectly. I will test the functionality soon. I'm assuming you only made one change to the dependencies and not functional code changes.

Best to you!!

Y-Sindo commented 2 years ago

created a fresh Visual Studio Azure Functions project targetting .NET 6.0. Worked perfectly. I will test the functionality soon. I'm assuming you only made one change to the dependencies and not functional code changes.

@longtimedeveloper There are new features added which you could get from the release page. We don't want to introduce breaking changes, but if you find any new problems, please let me know.