net_automatic_interface icon indicating copy to clipboard operation
net_automatic_interface copied to clipboard

Upgrade to 4.0.0 or 4.1.0 omits namespaces in generated code

Open realbart opened this issue 6 months ago • 8 comments

This is an example of generated code in the new versions. Not that the Azure.Core namespace is missing from "TokenCredential"

//--------------------------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// </auto-generated>
//--------------------------------------------------------------------------------------------------

using System.CodeDom.Compiler;

namespace MobiManagement.Web.Api
{
    [GeneratedCode("AutomaticInterface", "")]
    public partial interface IConfigurator
    {
        /// <inheritdoc />
        void ConfigureServices(IConfiguration configuration, IServiceCollection services, TokenCredential credential);
        
        /// <inheritdoc />
        void AddApplicationInsights(IConfiguration configuration, ILoggingBuilder loggingBuilder);
        
    }
}

In the old version, namespaces were always included, which is perfectly fine (and in this case better) for generated code. (you might even consider putting the "global::" prefix before them, preventing problems in some edge cases)

//--------------------------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// </auto-generated>
//--------------------------------------------------------------------------------------------------

using System.CodeDom.Compiler;

namespace MobiManagement.Web.Api
{
    [GeneratedCode("AutomaticInterface", "")]
    public partial interface IConfigurator
    {
        /// <inheritdoc />
        void ConfigureServices(Microsoft.Extensions.Configuration.IConfiguration configuration, Microsoft.Extensions.DependencyInjection.IServiceCollection services, Azure.Core.TokenCredential credential);
        
        /// <inheritdoc />
        void AddApplicationInsights(Microsoft.Extensions.Configuration.IConfiguration configuration, Microsoft.Extensions.Logging.ILoggingBuilder loggingBuilder);
        
    }
}

realbart avatar Aug 12 '24 11:08 realbart