Activities of "tylerje"

This approach has not worked for me. I'll continue experimenting and post if I can find the solution.

Thanks, but being rather new to ABP, I'm not seeing an obvious way of doing that. Can you provide an example of how the default implementation could be replaced? I'm trying the following but it's not working:

public class DevProxyHttpClientFactory : IProxyHttpClientFactory, ITransientDependency
{
    private readonly IHttpClientFactory _httpClientFactory;

    public DevProxyHttpClientFactory(IHttpClientFactory httpClientFactory)
    {
        _httpClientFactory = httpClientFactory;
    }

    public HttpClient Create()
    {
        var client = _httpClientFactory.CreateClient("DevClient");

        return client;
    }

    public HttpClient Create(string name)
    {
        return _httpClientFactory.CreateClient("DevClient");
    }
}

And in the program.cs I'm doing this:

if (builder.Environment.IsDevelopment())
{
    builder.Services.AddHttpClient("DevClient", client => {
        client.Timeout = TimeSpan.FromMinutes(1);
    })
    .ConfigurePrimaryHttpMessageHandler(() => {
        var httpClientHandler = new HttpClientHandler();
        httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
        return httpClientHandler;
    });

    builder.Services.Remove(ServiceDescriptor.Transient<IProxyHttpClientFactory, DefaultProxyHttpClientFactory>());
    builder.Services.AddTransient<IProxyHttpClientFactory, DevProxyHttpClientFactory>();
}

If you have an example that works, I'd be delighted to see it.

If you have an example, I'd be grateful if you shared it. I'm having trouble figuring out how to do it.

Thanks. So, you're saying create a dev environment replacement class like:

public class DevProxyHttpClientFactory : IProxyHttpClientFactory, ITransientDependency

That will create an HttpClient with an

var httpHandler = new HttpClientHandler();
httpHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;

in the creation of the HttpClient.

Then inject that IProxyHttpClientFactory instance DevProxyHttpClientFactory if in Development?

That's weird. The CLI now creates solutions with 7.0.1 packages. Just a week ago, it did not. I tried it multiple times.

Just to be clear. I'm asking two questions:

  1. Why does the 7.0.1 CLI still produce solutions that reference the 7.0.0 packages?
  2. Why does the bug identified above exist in the 7.0.1 packages when it is so easily identified and fixed?

The answers to those two questions will help me evaluate your approach to quality and testing. I need to know that you're taking a proactive approach to resolving these issues and preventing them from happening again.

The bug doesn't happen in the 7.0.0 packages. The bug happens in the 7.0.1 packages. It's definitely not fixed. So I have no idea what you're talking about when you say "We have released the 7.0.1 packages. And it was fixed in 7.0.1"

The fix to the LanguageInfo class would appear be simple. You have TwoLetterISOLanguageName marked NotNull but you provide no ctor with that property. Either fix the class or add the exclusion to AutoMapper in your own code.

using System;
using System.Globalization;
using JetBrains.Annotations;

namespace Volo.Abp.Localization;

[Serializable]
public class LanguageInfo : ILanguageInfo
{
    [NotNull]
    public virtual string CultureName { get; protected set; }

    [NotNull]
    public virtual string UiCultureName { get; protected set; }

    [NotNull]
    public virtual string DisplayName { get; protected set; }

    [NotNull]
    public virtual string TwoLetterISOLanguageName { get; protected set; }

    [CanBeNull]
    public virtual string FlagIcon { get; set; }

    
    protected LanguageInfo()
    {

    }

    public LanguageInfo(
        string cultureName,
        string uiCultureName = null,
        string displayName = null,
        string flagIcon = null)
    {
        ChangeCultureInternal(cultureName, uiCultureName, displayName);
        FlagIcon = flagIcon;
    }

    public virtual void ChangeCulture(string cultureName, string uiCultureName = null, string displayName = null)
    {
        ChangeCultureInternal(cultureName, uiCultureName, displayName);
    }

    private void ChangeCultureInternal(string cultureName, string uiCultureName, string displayName)
    {
        CultureName = Check.NotNullOrWhiteSpace(cultureName, nameof(cultureName));

        UiCultureName = !uiCultureName.IsNullOrWhiteSpace()
            ? uiCultureName
            : cultureName;

        DisplayName = !displayName.IsNullOrWhiteSpace()
            ? displayName
            : cultureName;
        
        TwoLetterISOLanguageName = new CultureInfo(cultureName)
            .TwoLetterISOLanguageName;
    }
}
using AutoMapper;
using Volo.Abp.AutoMapper;
using Volo.Abp.LanguageManagement;
using Volo.Abp.Localization;

namespace Platform.Portal.Blazor;

public class PortalBlazorAutoMapperProfile : Profile
{
    public PortalBlazorAutoMapperProfile()
    {
        //Define your AutoMapper configuration here for the Blazor project.
        CreateMap<Language, LanguageInfo>()
            .Ignore(x => x.TwoLetterISOLanguageName);
    }
}

Adding that eliminates the error. So that leaves two questions.

  1. Why does the 7.0.1 CLI still use the 7.0.0 packages?
  2. Why does this bug exist in the 7.0.1 packages when it is so easily discovered in simple happy path testing?
Showing 1 to 8 of 8 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11