IntentArchitect / Support

A repository dedicated to handling issues and support queries
3 stars 0 forks source link

TFG - Issues with upgrading on Intent.VisualStudio.Project #69

Closed HallCraig closed 9 months ago

HallCraig commented 9 months ago

What happened?

Getting few errors when upgrading a TFG project from 3.3.29 to 3.3.30.

! have another project that works on 3.3.32 but fails on 3.4.0

image

image

issue: on 3.4.0

image

Thanks Craig

What version of Intent Architect are you using?

v4

Additional information

No response

joelsteventurner commented 9 months ago

Hi @HallCraig

I've taken a quick look around and have some answers,

1) The first screen shot seems to be a deserialization issue, I know we did address a serialization issue around command names, this fix was in 3.3.31. In versions prior to 3.3.31 the commandName in launchsettings.json needs to be one of the following (with the corresponding casing) [DebugRoslynComponent, Docker, DockerCompose, Executable, Iis, IisExpress, MsixPackage, Project] It's probably the Iis one.

If you share the launchSetting,json with me I can also check this for you.

2) I am still looking into this ans will revert.

3) I can see our side we've made the XmlNameSpaceHelper class internal in 3.4. Let me justy double check and get back to you but I think we should be able to release a hotfix making this public again.

HallCraig commented 9 months ago
  1. Is it maybe becasue I have WSL2? { "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:20774/", "sslPort": 44380 } }, "profiles": { "IIS Express": { "commandName": "IisExpress", "launchBrowser": true, "launchUrl": "index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Local", "ProductEntityVault_SecretId": "" } }, "ProductEntityApi": { "commandName": "Project", "launchBrowser": true, "launchUrl": "index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Local" }, "applicationUrl": "https://localhost:5001;http://localhost:5000" }, "Docker": { "commandName": "Docker", "launchBrowser": true, "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "local", "ProductEntityVault_SecretId": "" }, "publishAllPorts": true }, "Tfg.ProductEntity.Api": { "commandName": "Project", "launchBrowser": true, "launchUrl": "index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "local", "ProductEntityVault_SecretId": "" }, "applicationUrl": "https://localhost:5012;http://localhost:5013", "publishAllPorts": false, "useSSL": false }, "Tfg.ProductEntity.Api-Dev": { "commandName": "Project", "launchBrowser": true, "launchUrl": "index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:5012;http://localhost:5013", "publishAllPorts": false, "useSSL": false }, "Tfg.ProductEntity.Api-Tst": { "commandName": "Project", "launchBrowser": true, "launchUrl": "index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Test" }, "applicationUrl": "https://localhost:5012;http://localhost:5013", "publishAllPorts": false, "useSSL": false }, "Tfg.ProductEntity.Api-Prd": { "commandName": "Project", "launchBrowser": true, "launchUrl": "index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Production" }, "applicationUrl": "https://localhost:5012;http://localhost:5013", "publishAllPorts": false, "useSSL": false }, "WSL": { "commandName": "WSL2", "launchBrowser": true, "launchUrl": "https://localhost:5001/index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Local", "ASPNETCORE_URLS": "https://localhost:5001;http://localhost:5000" }, "distributionName": "" } } }
HallCraig commented 9 months ago

Yes, it is :) need to add support WSL2

HallCraig commented 9 months ago

image

joelsteventurner commented 9 months ago

100% that's an Issue, we don't have that value on the Enum which is used for deserialization. We will definitely add it as an Option.

HallCraig commented 9 months ago

Joel, 1 other thing, I have to review all my files in v4 because of this change...this will be complained about from every dev team. Any reason image

JonathanLydall commented 9 months ago

Joel, 1 other thing, I have to review all my files in v4 because of this change...this will be complained about from every dev team. Any reason image

Hi @HallCraig,

For consistency this now orders the attributes, but I can fully see this being a bit of a pain for some teams. We can absolutely make it an option to "leave it alone", then these teams can just enable that option?

joelsteventurner commented 9 months ago

On the second issue

I can't exactly see what is happening as it's happening mostly within your modules, Either the outputTarget is null or the outputTarget.Applciation is null Could you share the code for TFG.Modules.Diagnostics.FactoryExtensions.HealthCheckEndpointEvent

HallCraig commented 9 months ago

Lets leave it for now . I will communicate and try manage from this end.

HallCraig commented 9 months ago

On the second issue

I can't exactly see what is happening as it's happening mostly within your modules, Either the outputTarget is null or the outputTarget.Applciation is null Could you share the code for TFG.Modules.Diagnostics.FactoryExtensions.HealthCheckEndpointEvent

using Intent.Engine; using Intent.Modules.Common; using Intent.Modules.Common.Templates; using Intent.Modules.Common.VisualStudio; using Intent.Modules.VisualStudio.Projects.Api; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TFG.Modules.Common; using TFG.Modules.Diagnostics.Api;

namespace TFG.Modules.Diagnostics.FactoryExtensions { public class HealthCheckEndpointEvent : IBaseEvent, IEndpointEvent, IReferenceEvent, IServiceEntryEvent, IOutputTargetEvent { private ASPNETCoreWebApplicationModel _target;

    public string Name => "HealthCheckEndpointEvent";

    public IOutputTarget OutputTarget { get; set; }

    public IEnumerable<(int Order, string Entry)> GetConfigureServiceEntries(IntentTemplateBase templateBase)
    {
        if (_target.HasDiagnostics() &&
            _target.GetDiagnostics().HealthChecks().Length == 0)
        {
            yield return (700, $".AddHealthChecks()");
        }

        if (_target.HasDiagnostics() &&
            _target.GetDiagnostics().HealthChecks().Length > 0)
        {
            yield return (700, $".AddHealthChecks(builder => builder");
            yield return (701, $"   .AddSql(\"tfg.{OutputTarget.ApplicationName().ToLowerInvariant() }\")");
            yield return (702, $")");
        }
    }

    public IEnumerable<string> GetEndpoints()
    {
        yield break;
    }

    public IEnumerable<(string Role, INugetPackageInfo PackageInfo)> GetPackageReferences()
    {
        yield return (Roles.Infrastructure, NugetPackages.TfgPatternsAppHealthHelper);
    }

    public IEnumerable<string> GetTemplateReferences()
    {
        yield break;
    }

    public IEnumerable<(int Order, string Entry)> GetUseServiceEntries()
    {
        yield return (410, ".UseHealthChecks()");
    }

    public bool IsEnabled(IVisualStudioProject target)
    {
        if (target is ASPNETCoreWebApplicationModel model
           && model.HasDiagnostics()
           && model.GetDiagnostics().AddHealthChecks())
        {
            _target = model;

            return true;
        }

        return false;
    }
}

}

HallCraig commented 9 months ago

On the second issue I can't exactly see what is happening as it's happening mostly within your modules, Either the outputTarget is null or the outputTarget.Applciation is null Could you share the code for TFG.Modules.Diagnostics.FactoryExtensions.HealthCheckEndpointEvent

using Intent.Engine; using Intent.Modules.Common; using Intent.Modules.Common.Templates; using Intent.Modules.Common.VisualStudio; using Intent.Modules.VisualStudio.Projects.Api; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TFG.Modules.Common; using TFG.Modules.Diagnostics.Api;

namespace TFG.Modules.Diagnostics.FactoryExtensions { public class HealthCheckEndpointEvent : IBaseEvent, IEndpointEvent, IReferenceEvent, IServiceEntryEvent, IOutputTargetEvent { private ASPNETCoreWebApplicationModel _target;

    public string Name => "HealthCheckEndpointEvent";

    public IOutputTarget OutputTarget { get; set; }

    public IEnumerable<(int Order, string Entry)> GetConfigureServiceEntries(IntentTemplateBase templateBase)
    {
        if (_target.HasDiagnostics() &&
            _target.GetDiagnostics().HealthChecks().Length == 0)
        {
            yield return (700, $".AddHealthChecks()");
        }

        if (_target.HasDiagnostics() &&
            _target.GetDiagnostics().HealthChecks().Length > 0)
        {
            yield return (700, $".AddHealthChecks(builder => builder");
            yield return (701, $"   .AddSql(\"tfg.{OutputTarget.ApplicationName().ToLowerInvariant() }\")");
            yield return (702, $")");
        }
    }

    public IEnumerable<string> GetEndpoints()
    {
        yield break;
    }

    public IEnumerable<(string Role, INugetPackageInfo PackageInfo)> GetPackageReferences()
    {
        yield return (Roles.Infrastructure, NugetPackages.TfgPatternsAppHealthHelper);
    }

    public IEnumerable<string> GetTemplateReferences()
    {
        yield break;
    }

    public IEnumerable<(int Order, string Entry)> GetUseServiceEntries()
    {
        yield return (410, ".UseHealthChecks()");
    }

    public bool IsEnabled(IVisualStudioProject target)
    {
        if (target is ASPNETCoreWebApplicationModel model
           && model.HasDiagnostics()
           && model.GetDiagnostics().AddHealthChecks())
        {
            _target = model;

            return true;
        }

        return false;
    }
}

}

Sorry ignore second issue resolved...now I'm on 3.3.32 of module

HallCraig commented 9 months ago

Only issue now moving to 3.4.0

joelsteventurner commented 9 months ago

I have put a pre-release out for you. Intent.VisualStudio.Projects v3.4.1-pre.1 This includes the Command Name option WSL2 and I made the XmlNameSpaceHelper class public.

Give a try and let me know if this resolves all the issues.

HallCraig commented 9 months ago

You sure? I'm still getting both issues upgrading to your pre version

joelsteventurner commented 9 months ago

I see I missed the namespace also changed, I've rolled that back too, will have a new patch out as soon as our build is finished.

joelsteventurner commented 9 months ago

I put out another pre-release Intent.VisualStudio.Projects v3.4.1-pre.2

This aligning the namessapce of XmlNameSpaceHelper class.

Let me know if this sorts it all out.

HallCraig commented 9 months ago

Still have issue with WSL2 image

HallCraig commented 9 months ago

XmlNameSpaceHelper issue resolved

joelsteventurner commented 9 months ago

Let me take a closer look at the WSL2 and revert.

joelsteventurner commented 9 months ago

I have a new pre-release out for you, Intent.VisualStudio.Projects v3.4.1-pre.3

This should be it all sorted, let me know if there are any other issues.

HallCraig commented 9 months ago

Thanks, all sorted.