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?

  • ABP Framework version: v7.0.1
  • UI type: blazor-server
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
System.Net.Sockets.SocketException (111): Connection refused
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   
System.Net.Http.HttpRequestException: Connection refused (platform.portal.httpapi.host:54366)
 ---> System.Net.Sockets.SocketException (111): Connection refused
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.<SendAsync>g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.<SendAsync>g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync(ClientProxyRequestContext requestContext)
   
Volo.Abp.Http.Client.AbpRemoteCallException: An error occurred during the ABP remote HTTP request. (Connection refused (platform.portal.httpapi.host:54366)) See the inner exception for details.
 ---> System.Net.Http.HttpRequestException: Connection refused (platform.portal.httpapi.host:54366)
 ---> System.Net.Sockets.SocketException (111): Connection refused
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.&lt;ConnectAsync&gt;g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.&lt;SendAsync&gt;g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.&lt;SendAsync&gt;g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.&lt;SendAsync&gt;g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync(ClientProxyRequestContext requestContext)
   --- End of inner exception stack trace ---
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync(ClientProxyRequestContext requestContext)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](ClientProxyRequestContext requestContext)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments)
   at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies.AbpApplicationConfigurationClientProxy.GetAsync(ApplicationConfigurationRequestOptions options)
   at Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient.GetRemoteConfigurationAsync()
   at Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient.&lt;GetAsync&gt;b__16_0()
   at Volo.Abp.Caching.DistributedCache`2.GetOrAddAsync(TCacheKey key, Func`1 factory, Func`1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
   at Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient.GetAsync()
   at Volo.Abp.AspNetCore.Mvc.Client.RemoteLanguageProvider.GetLanguagesAsync()
   at Microsoft.AspNetCore.RequestLocalization.DefaultAbpRequestLocalizationOptionsProvider.GetLocalizationOptionsAsync()
   at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.&lt;&gt;c__DisplayClass6_1.&lt;&lt;UseMiddlewareInterface&gt;b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
  • Steps to reproduce the issue:" Build docker-compose project and launch auth server, blazor server app, and http api host in separate containers. The compose puts them all in the same Docker network. The self-signed dev certificate works fine for the blazor app but when it tries to talk to the http api host using the compose configured name with that same name pointing to 127.0.0.1 in the Windows hosts file, I get the error above.

I'm assuming that it is just that the AbpHttpClientModule's ConfigureServices method calls context.Services.AddHttpClient(). I'm not certain how to alter the behavior in Development mode to get the app to accept the ASP.NET self signed certificate. In other apps, I've used ServicePointManager.ServerCertificateValidationCallback = delegate { return true; } but this does not work in ABP.

It's important to me that I am able to debug using Linux containers in WSL2 on my local machine. If you have any suggestions to be able to get around this, I would be grateful.

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?

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v7.0.1
  • UI type: blazor-server
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:

AutoMapper.AutoMapperConfigurationException: Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters

Language -> LanguageInfo (Destination member list) Volo.Abp.LanguageManagement.Language -> Volo.Abp.Localization.LanguageInfo (Destination member list)

Unmapped properties: TwoLetterISOLanguageName

at Volo.Abp.AutoMapper.AbpAutoMapperModule.<>c__DisplayClass2_1.<CreateMappings>g__ValidateAll|2(IConfigurationProvider config) at Volo.Abp.AutoMapper.AbpAutoMapperModule.CreateMappings(IServiceProvider serviceProvider) at Autofac.Extensions.DependencyInjection.AutofacRegistration.<>c__DisplayClass3_0.<Register>b__0(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Delegate.DelegateActivator.<ConfigurePipeline>b__2_0(ResolveRequestContext ctxt, Action1 next) at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next)

  • Steps to reproduce the issue:" 1) Update ABP CLI to 7.0.1 from 7.0.0. 2) Create a new solution using blazor-server. 3) Add two modules using --new --add-to-the-solution. 4) Run DbMigrator. 5) Upgrade Volo.* NuGet packages from 7.0.0 to 7.0.1. 6) Run in debug mode and get the above error.
Showing 1 to 10 of 10 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11