Skip to content
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

Generator doesn't warn when [FunctionName] is specified on a private function #619

Open
AtOMiCNebula opened this issue Aug 21, 2023 · 3 comments

Comments

@AtOMiCNebula
Copy link

The Generator will happily generate a functions.json for code that the host can't handle. Specifically, code like this:

public class ExampleFunctions
{
    [FunctionName("Foo")]
    private void Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
    {
        // ...
    }
}

The Functions Host doesn't actually load the function because it's private (and reports a single trace log about it in App Insights, oy). Either the Generator should throw a warning/error in this case, or the host should enumerate private methods. Just need both parts to be consistent with each other. 😄

@bhagyshricompany
Copy link

Thanks for reporting will discuss and update.

@bhagyshricompany
Copy link

bhagyshricompany commented Sep 19, 2023

The error message suggests that the Azure Functions host doesn't load the function because it's marked as private.is there you specifically use private method otherwise if you create public method then this error will not face.

@AtOMiCNebula
Copy link
Author

@bhagyshricompany / @fabiocav, yes I'm aware. The problem I'm trying to highlight is that this should be something the Generator reports as an error at compile-time, not as a warning/trace at run-time. The generator should not generate a host.json that it knows the host won't actually be able to process.

I've reported a similar issue where the Generator generates doomed-to-fail host.json when there are multiple overloads of a function in #583.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants