Azure / azure-webjobs-sdk

Azure WebJobs SDK
MIT License
737 stars 358 forks source link

Issue function app using SignalR Client preview2-final #1678

Open tomkluskens opened 6 years ago

tomkluskens commented 6 years ago

I have a function app targetting .net standard 2.0 (using Microsoft.NET.Sdk.Functions 1.0.13).

In the function I want to use a signalr client to send a message to an external signalr hub. I use in the function app the Microsoft.AspNetCore.SignalR.Client (1.0.0-preview2-final) to communicate with the signalr hub.

Running the function app when instantiating a HubConnection, the following exception is thrown in the following method:

Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync

Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

StackTrace:

   at Microsoft.AspNetCore.SignalR.Client.HubConnectionBuilder.Build()
   at SignalRFunctionApp.ChatHubClient..ctor(String endpoint) in D:\VS\SignalRFunctionApp\SignalRFunctionApp\ChatHubClient.cs:line 18
   at SignalRFunctionApp.FunctionSignalR.Run(TimerInfo myTimer, TraceWriter log) in D:\VS\SignalRFunctionApp\SignalRFunctionApp\FunctionSignalR.cs:line 15
   at lambda_method(Closure , FunctionSignalR , Object[] )
   at Microsoft.Azure.WebJobs.Host.Executors.VoidMethodInvoker`2.InvokeAsync(TReflected instance, Object[] arguments) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\VoidMethodInvoker.cs:line 20
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.<InvokeAsync>d__9.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 63
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<InvokeAsync>d__23.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 532
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithWatchersAsync>d__22.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 483
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__21.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 426
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__15.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 231

The Microsoft.AspNetCore.SignalR.Client package has dependencies to .net core 2.1 assemblies. Is this causing the issue? And if so, can I work around it with the current version of Microsoft.NET.Sdk.Functions?

paulbatum commented 6 years ago

@fabiocav FYI - the PR you have open (https://github.com/Azure/azure-functions-host/pull/2734) might help with this.

paulbatum commented 6 years ago

Functions is not running on ASP.NET core 2.1 right now, but it will be soon and hopefully this error will disappear at that point.

paulbatum commented 6 years ago

Here's a relevant issue to the upgrade: https://github.com/Azure/azure-webjobs-sdk/issues/1206

tomkluskens commented 6 years ago

Is there a timeline availabe when functions will be running on core 2.1?

fabiocav commented 6 years ago

No firm timeline at this point, but if you watch the issue @paulbatum linked to, that will be one of the signals of progress in that direction.

tomkluskens commented 6 years ago

Hi, is there any news about when azure functions will be updated to run on dotnetcore 2.1? Or do you have links to info about timelines? At this moment we start migrating our application landscape from 2.0 to 2.1 (as 2.0 reaches End Of Life October 1st 2018) but we can't do that for the azure function parts.

paulbatum commented 6 years ago

Functions V2 runs on .NET Core 2.1, as of a month or so ago.

paulbatum commented 6 years ago

Here's the relevant release: https://github.com/Azure/azure-functions-host/releases/tag/v2.0.11888-alpha

tomkluskens commented 6 years ago

Great! We missed that one! We were looking somehow to the wrong repo. Thanks for your quick answer.