-
Notifications
You must be signed in to change notification settings - Fork 66
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
NullReferenceException during build #641
Comments
The root of the problem seems to be a nullable argument from a [FunctionName("DoStuff")]
public Task DoStuff([HttpTrigger("get", Route = "v1/DoStuff/{arg?}")] HttpRequest req, string? arg, ILogger log)
{
return Task.CompletedTask;
} When changing the type from |
Thanks for updating will check and update the same. |
I'm getting this issue but I don't have any HttpTrigger decorated functions with a nullable route segment in fact all of my HttpTrigger functions are parameterless except an "HttpRequest req" parameter |
I am checking.Will update. |
I'm getting the same going from v4.0.0 to v4.4.0. Haven't found out what triggers it yet.
|
if possible can you share the code snippet or still you getting the same issue. |
I'll try to find at repro, and post it if/when I do. But with no indication of what is actually going wrong, there's not much to go on. I can understand wanting to find a root cause. Just tested with 4.1.0 -> 4.3.0 and all have the same error. |
Cause of error seems to be using a tuple return value in my case:
Fixed by returning class type instead. |
I had a similar error. I commented out all the [FunctionName] attributes in my project and added them back in until I found the one causing the error. I my case the problem was a function that returned a Now the return type is |
Still a problem |
I also experienced the issue with a return value of |
I also encountered this issue because I enabled enable, when I use any nullable returns of a durable, like Task<Resource?>, this build error happens. |
Still a problem. The exact source line and the trigger have been identified and confirmed by several people, I have no idea which "additional feedback" MS bot says this issue requires |
please share the all sdk lib used with version.Thanks |
Thanks @impworks I was able to repro with the below function code. [FunctionName("Function1")]
public IActionResult Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "foo/{id}")] HttpRequest req, string? id)
{
return new OkObjectResult("hello world");
} We will update the SDK with a fix. I will share an update on this thread when it is ready. Thanks for your patience. |
Version 4.4.1 has been released, which includes a fix for this issue. Please upgrade to this version. Thank you for your patience. https://www.nuget.org/packages/Microsoft.NET.Sdk.Functions/4.4.1 |
After updating the project to .NET 8 I started getting build errors:
The NuGet package version is the latest currently available (4.4.0).
The text was updated successfully, but these errors were encountered: