Thanks for opening an issue in the Azure technical documentation repository.
We use GitHub issues as the primary channel for customer and community feedback about the Azure documentation.
We prefer that you create documentation feedback issues using the Feedback link on the published article - the feedback control on the doc page creates an issue that contains all the article details so you can focus on the feedback part.
You can also create a feedback issue here in the repo. If you do this, please make sure your issue lists:
If you know the change that is needed in an article, we encourage you to submit the changes directly using a pull request. If the change is large, or if you want to contribute an entire article, follow these guidelines:
We'll route the issue to the appropriate content team for review and discussion.
If you would like to contact Microsoft about other things, such as product feedback or tech support, please review these guidelines:
If you need technical support using Azure, the paid and free support options are described here: https://azure.microsoft.com/support/options/.
Each article in the Azure technical documentation contains a product feedback button - it's best to submit product feedback directly from a relevant article. Otherwise, you can submit product feedback for most Azure products in the following product feedback forum: https://feedback.azure.com/forums/34192--general-feedback.'
⚠Bearbeiten Sie diesen Abschnitt nicht. Er ist für die Verknüpfung von docs.microsoft.com zum GitHub-Artikel erforderlich.
@curelom , Could you please share the document that you are referring to.
I have the same issue:
System.Private.CoreLib: Exception while executing function: HttpTriggerCSharp. EFAzureTest: Could not load type 'Microsoft.AspNetCore.Http.Internal.DefaultHttpRequest' from assembly 'Microsoft.AspNetCore.Http, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
HttpRequest req = new DefaultHttpRequest(httpContext)
{
Method = "GET",
Host = request.Host,
Path = request.Path,
QueryString = request.QueryString
};
@curelom , @MarcHochleutner-Koellisch , Could you please share the document that you are referring to.
@curelom @MarcHochleutner-Koellisch This channel is for driving improvements towards MS Docs,If you have question specific to product , it would be best if you can create the product issue to the official Azure Functions Repo for better clarity.
@curelom So for now I will proceed with closure of this and If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.
@DixitArora-MSFT please reopen this issue. The issue is that the documentation provides examples that do not work with .net core 3.1 anymore.
Correct, my issue is with the documentation itself. Yes lease reopen
you can probably replace DefaultHttpRequest
with
var context = new DefaultHttpContext();
var defaultHttpRequest = context.Request;
I agree with the OP, it's pretty dismal that the code sample in the documentation uses an class that is marked as internal (and for those who don't understand that, means us mere mortals can't use it) - nothing to do with the product, the majority know where to go if we have comments about the actual product....
Guidance on how to actually do this would be great. How do I now set the Request object for testing a controller?
I'm not sure if this is a documentation or a library issue, but in my case I tracked it down to a buffering flag in the Function framework used by ReadAsStringAsync()
which means the call succeeds when the code is run via Kestrel but fails when run from unit tests.
Looking at the dependency chain, it should be referencing the fixed version (i.e. anything after this commit: https://github.com/Azure/azure-webjobs-sdk-extensions/commit/ff2440ac1f657ba76f5ab5a3cefafa3c55a50fdb#diff-fb4adb7f5777825d3a3b1767ad9071e4 )
I fixed it by running my own version of ReadAsStringAsync()
and the code in the documentation works. It's a kludge, but it looks like an SDK issue.
Most helpful comment
you can probably replace
DefaultHttpRequest
with