New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method not found: System.Net.Http.HttpRequestMessageExtensions.CreateResponse when referencing .Net Standard Project #477
Comments
We have the same problem and cannot use the workaround as we are dependent on https://github.com/microsoftgraph/msgraph-sdk-dotnet which is dependant on System.Net 4.3.2 |
I'm having a similar issue; after referencing a .NET standard class library, I'm unable to even trigger the function in development, with the function resulting in the following exception:
|
Same issue and can't use the workaround as one of our assemblies depends on System.Net.Http 4.3.2. |
After installing Azure Functions and Web Jobs Tools 15.0.30901.0 my error have changed to: "Could not load file or assembly 'System.IdentityModel.Tokens.Jwt, Version=4.0.40306.1554, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified." Is there a workaround for this? |
Also experiencing the same issue. Exact same steps to reproduce but the issue occurs using the currently stable tooling, not just the previews. My Tooling:
My Project
|
Should be fixed by Azure/azure-functions-host@be779c7 Deployment is scheduled to start 9/13. Likely to complete globally by 9/20. You'll be required to update the azure functions core tools at that point. We'll update this issue with the exact version number once we have it. Feel free to throw rocks at me here or on twitter (@paulbatum) if there is no update on this thread by 9/22. |
I had the same issue. Azure Functions can not find the method. I also tried to create the Response message with its own constructor. Using constructor allows Functions to debug, but the browser could not get any response. |
I spend quite a while to fix this problem. It seems that Azure functions can not refer to .Net Standard Lib targeting .Net Standard Version higher than 1.4. I hope they could fix this soon. |
The fix is going out a part of the 1.0.11232 release. Deployment is still in progress but its already fully done in North Central US, West US 2. Creating a new function app in one of these regions or restarting an existing one should be sufficient to get the update. A core tools release with this change is still coming. |
Version 1.0.4 of Azure Functions Core Tools is out with this fix. However VS currently has a bug where it does not autoupdate to the newest version of the tools. I recommend you follow the steps documented here for grabbing the latest tools and then configuring VS to use them. The fix is now deployed to Azure globally so you should not run into any problems once you publish to the cloud. You may have to do a restart on your function app to make sure it picks up the updated runtime. Please let us know if this does not resolve your issues with referencing .NET Standard 2.0 packages. Thanks for your patience! |
I created a standard httptrigger function just today. Works fine until I add a project.json file with a dependency to Microsoft.Azure.Devices.Client 1.2.10. Then I get http errors during compilation: This is directly in the function editor on portal.azure.com. project.json file: 2017-09-21T19:44:14.167 run.csx(12,29): error CS1929: 'HttpContent' does not contain a definition for 'ReadAsAsync' and the best extension method overload 'HttpContentExtensions.ReadAsAsync(HttpContent)' requires a receiver of type 'HttpContent' |
@paulbatum This fix seems to have introduced a new .net Standard 2.0 error. Now, if you reference a .Net Standard2.0 project, and your functionapp uses an On Australia Southeast, this error did not occur as recently as 32 hours ago. We first noticed this issue 24 hours ago.
|
@ewilsonambient I do not believe that error is related to the change this thread is discussing. This is because I was still able to repro this error on an older versions of functions (specifically 1.0.11027) that does not have the fix discussed here. I have not looked to closely, but as far as I know there is an incompatibility between Azure Functions and more recent versions of the Microsoft.Azure.Devices.Client NuGet in that it relies on binding redirects and Azure Functions does not support binding redirects currently. Try using version 1.0.17. e.g.
If you wish to discuss further I suggest you file a new issue so we can keep this thread on topic. Thanks! |
@elexisvenator I'm having trouble reproducing this. I made a new function app in VS, updated to our latest bits (https://www.nuget.org/packages/Microsoft.NET.Sdk.Functions/1.0.4 which includes updated dependencies), added a http trigger and changed the TraceWriter to ILogger and deployed to a new function app in Azure and confirmed that the function worked fine. I then thought it might be related to function apps compiled against older bits so I downgraded to Microsoft.NET.Sdk.Functions/1.0.0, built and deployed and it still worked. I looked at some of our logs and I can see the ILogger related error If you can figure out a simplified repro that would be very helpful. |
@paulbatum I have done some more testing over the weekend and found that my issue is not with .Net Standard projects, but rather with manually referencing Microsoft.Extensions.Logging.Abstractions >1.1.1, either directly or via another nuget package as I was doing. Microsoft.NET.Sdk.Functions 1.0.4 uses Abstractions v1.1.1 and upgrading that package to any higher issue seems to cause the issues. I have a small repo here to test the issue with. |
@paulbatum related: #334 |
@elexisvenator this is indeed an issue where a reference outside of our redirect range causes a type mismatch with the binding provider that supports We'll address this on the next release. In the meantime, please target version 1.1.1 or lower. Thank you for reporting this! |
If an Azure Functions project which uses Http triggers references a .Net Standard class library, the functions tooling throws Method not found exceptions.
Example Project: https://github.com/kensykora/musicbot-backend/tree/98eb1fb43498681c7a80381d4dcc46c1c2c011c1 (use this specific commit, as I've worked around it, see below)
Related Stack Overflow Post: https://stackoverflow.com/questions/45271133/httprequestmessageextensions-not-being-found-at-run-time-in-azure-function#comment78861154_45273862
Tooling / Versions:
Steps to reproduce:
Expected: No Errors
Actual: HttpMissingMethodException:
Error from my local functions CLI tool:
Workaround: Change the class library project to .Net Framework
The text was updated successfully, but these errors were encountered: