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

ExtensionStartupRunnerGenerator generating code which conflicts with customer code (namespace) #2542

Closed
kshyju opened this issue Jun 18, 2024 · 0 comments · Fixed by #2553
Closed
Assignees
Labels
bug Something isn't working

Comments

@kshyju
Copy link
Member

kshyju commented Jun 18, 2024

Description

The ExtensionStartupRunnerGenerator source generator is generating code which conflicts with customer code.

Steps to reproduce

  1. Create a function app with a service bus trigger.
  2. Create a new class in the project with below code.
namespace TheProjectNameFromStep1.Exception
{
    internal class Foo 
    {
    }
}

Replace TheProjectNameFromStep1 with your project name.

This will cause CS0118 'Exception' is a namespace but is used like a type error because our source generator created the below code where Exception type is used in the catch block.

public override void Configure(IFunctionsWorkerApplicationBuilder applicationBuilder)
{
    try
    {
        new global::Microsoft.Azure.Functions.Worker.ServiceBusExtensionStartup().Configure(applicationBuilder);
    }
    catch (Exception ex)
    {
        // removed 
    }
}

Additionally, double-check other function source generators to see if they have the same issue.

@kshyju kshyju added the potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug label Jun 18, 2024
@fabiocav fabiocav added bug Something isn't working and removed Needs: Triage (Functions) potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants