-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Google.Cloud.Dialogflow.V2 Could not load file or assembly Google.Protobuf #1271
Comments
(As an aside for the future, for Unfortunately I believe this is basically because Azure Functions doesn't support assembly binding redirects. Within the transitive dependencies, there are probably dependencies on different versions of Google.Protobuf. In normal environments that would be fine - NuGet would resolve to the latest version, and use assembly binding redirects for earlier versions. That doesn't work on Azure Functions. See Azure/azure-functions-host#992 for more details, but unfortunately there's nothing we can reasonably do to fix this - we'd have to make sure that all our libraries targeted the exact same minor version of everything, including whatever version of Json.NET Azure Functions targets... it becomes infeasible pretty quickly :( |
Ok! Thanks for the fast response and very easy to understand! |
I'm just sorry I couldn't give better news :( I'm hopeful that Azure Functions will get past this over time - it really needs to in order to work for modern NuGet realities. |
Hi @german95n and @jskeet - I work on Azure Functions and we've been doing a bunch of work to try to make it so that functions behaves correctly in cases like this. I just tried this scenario out on our latest published V2 bits and I was not able to repro, but perhaps I am not following the right steps. I made a V2 app with a http trigger, and then I referenced the DialogFlow NuGet and used it from the function: <ItemGroup>
<PackageReference Include="Google.Cloud.Dialogflow.V2" Version="1.0.0-beta02" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.14" />
</ItemGroup> [FunctionName("Function1")]
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req, ILogger log)
{
var c = AgentsClient.Create();
return new OkObjectResult("test");
} I get this error:
Note that its not an assembly load error. You can make sure you're running on the same version as me by looking at this output: [8/14/2018 9:30:13 PM] Starting Host (HostId=pbatumhost-377753225, InstanceId=bcc50f76-eb56-4e0a-906d-641aaff34a98, Version=2.0.11946.0, ProcessId=35640, AppDomainId=1, Debug=True, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=) Let me know what you find. I would like to confirm that the work we've done has helped unblock scenarios such as this one. |
@paulbatum: Could you try the JSON parsing code from the first code snippet, just with some arbitrary value? It's possible that you're running into the Auth issue before the versioning collision comes into play. |
OK, I tested with a body of just [FunctionName("Function1")]
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req, ILogger log)
{
var json = new StreamReader(req.Body).ReadToEnd();
var webhookRequest = JsonConvert.DeserializeObject<WebhookRequest>(json);
return new OkObjectResult("test");
}
|
That's interesting. @german95n could you let us know which version of Google.Cloud.Dialogflow.V2 you were using? We released a new version with new dependencies a couple of weeks ago... I wonder whether that's why @paulbatum can't reproduce the problem. (This would only be "coincidentally correct" rather than due to any changes on our part around how dependencies are managed.) |
@paulbatum I had a previous version of the Azure Host. Updating the Azure Host to your version had solved the problem. I'm very pleased to know that I can use .Net Core now with the Azure Functions without setting the bindings explicitly. @jskeet I was using the beta 02. |
@german95n thats great! @jskeet Please reach out if you see any other users reporting problems loading these libraries in Azure Functions V2 so that we can investigate (unfortunately we do not have a good solution for users on V1) |
I have created a new Azure functions projects using .net core 2.0
And when I try to reference this package it says the following:
The function that is giving me the problem:
I have tried installing the Nuget package manually but that didn't work. Should I go back to .Net framework meanwhile this gets fixed or is a solution for this?
The text was updated successfully, but these errors were encountered: