Based on https://support.abp.io/QA/Questions/2359/CurrentTenant--Extra-Property
I tried to implement this in a new Module and using the Web.Unified Project to check it, but the constructor with ITenantRepository throws an exception at Autofac. What can I do ?
<br>
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy;
using Volo.Saas.Tenants;
namespace ReplaceICurrentTenant.AbpExtented;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(ICurrentTenant), typeof(CurrentTenant), typeof(MyCurrentTenant))]
public class MyCurrentTenant : CurrentTenant
{
private readonly ITenantRepository _tenantRepository;
public MyCurrentTenant(ICurrentTenantAccessor currentTenantAccessor, ITenantRepository tenantRepository ) : base(currentTenantAccessor)
{
}
public async Task<Dictionary<string, object>> GetExtraProperties()
{
if (!base.Id.HasValue)
{
return new Dictionary<string, object>();
}
//var tenant = await _tenantRepository.GetAsync((Guid)base.Id);
//implement your logic
//tenant.ExtraProperty
return new Dictionary<string, object>();
}
}
Here the exception: Autofac.Core.DependencyResolutionException HResult=0x80131500 Nachricht = An exception was thrown while activating Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionEndpointDataSourceFactory -> Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider -> λ:Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider[] -> Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider -> Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModelFactory -> λ:Microsoft.AspNetCore.Mvc.ApplicationModels.IApplicationModelProvider[] -> Microsoft.AspNetCore.Mvc.ApplicationModels.AuthorizationApplicationModelProvider -> Volo.Abp.Authorization.AbpAuthorizationPolicyProvider -> Volo.Abp.Authorization.Permissions.PermissionDefinitionManager -> Volo.Abp.PermissionManagement.DynamicPermissionDefinitionStore -> Volo.Abp.PermissionManagement.EntityFrameworkCore.EfCorePermissionGroupDefinitionRecordRepository -> Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1[[Volo.Abp.PermissionManagement.EntityFrameworkCore.IPermissionManagementDbContext, Volo.Abp.PermissionManagement.EntityFrameworkCore, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null]] -> Volo.Abp.MultiTenancy.MultiTenantConnectionStringResolver -> ReplaceICurrentTenant.AbpExtented.MyCurrentTenant -> Volo.Saas.EntityFrameworkCore.EfCoreTenantRepository -> Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1[[Volo.Saas.EntityFrameworkCore.ISaasDbContext, Volo.Saas.EntityFrameworkCore, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null]]. Quelle = Autofac Stapelüberwachung: bei Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next) bei Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) bei Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt) bei Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next) bei Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) bei Autofac.Core.Resolving.Middleware.SharingMiddleware.<>c__DisplayClass5_0.<Execute>b__0() bei Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func`1 creator) bei Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable`1 qualifyingId, Func`1 creator) bei Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next) bei Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) bei Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) bei Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next) bei Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) bei Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt) bei Autofac.Core.Resolving.ResolveOperation.InvokePipeline(ResolveRequest request, DefaultResolveRequestContext requestContext) bei Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request) bei Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request) bei Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request) bei Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request) bei Autofac.Core.Container.ResolveComponent(ResolveRequest request) bei Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) bei Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) bei Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters) bei Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType) bei Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType) bei Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) bei Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.GetOrCreateDataSource(IEndpointRouteBuilder endpoints) bei Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllerRoute(IEndpointRouteBuilder endpoints, String name, String pattern, Object defaults, Object constraints, Object dataTokens) bei Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule.<>c.<ConfigureServices>b__1_13(EndpointRouteBuilderContext endpointContext) bei Microsoft.AspNetCore.Builder.AbpAspNetCoreApplicationBuilderExtensions.<>c__DisplayClass0_0.<UseConfiguredEndpoints>b__0(IEndpointRouteBuilder endpoints) bei Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder builder, Action`1 configure) bei Microsoft.AspNetCore.Builder.AbpAspNetCoreApplicationBuilderExtensions.UseConfiguredEndpoints(IApplicationBuilder app, Action`1 additionalConfigurationAction) bei ReplaceICurrentTenant.ReplaceICurrentTenantWebUnifiedModule.OnApplicationInitialization(ApplicationInitializationContext context) in D:\Temp\ReplaceICurrentTenant\host\ReplaceICurrentTenant.Web.Unified\ReplaceICurrentTenantWebUnifiedModule.cs: Zeile203 bei Volo.Abp.Modularity.AbpModule.OnApplicationInitializationAsync(ApplicationInitializationContext context) bei Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.<InitializeAsync>d__0.MoveNext() Diese Ausnahme wurde ursprünglich von dieser Aufrufliste ausgelöst: [Externer Code] Innere Ausnahme 1: DependencyResolutionException: Circular component dependency detected: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionEndpointDataSourceFactory -> Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider -> λ:Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider[] -> Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider -> Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModelFactory -> λ:Microsoft.AspNetCore.Mvc.ApplicationModels.IApplicationModelProvider[] -> Microsoft.AspNetCore.Mvc.ApplicationModels.AuthorizationApplicationModelProvider -> Volo.Abp.Authorization.AbpAuthorizationPolicyProvider -> Volo.Abp.Authorization.Permissions.PermissionDefinitionManager -> Volo.Abp.PermissionManagement.DynamicPermissionDefinitionStore -> Volo.Abp.PermissionManagement.EntityFrameworkCore.EfCorePermissionGroupDefinitionRecordRepository -> Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1[[Volo.Abp.PermissionManagement.EntityFrameworkCore.IPermissionManagementDbContext, Volo.Abp.PermissionManagement.EntityFrameworkCore, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null]] -> Volo.Abp.MultiTenancy.MultiTenantConnectionStringResolver -> ReplaceICurrentTenant.AbpExtented.MyCurrentTenant -> Volo.Saas.EntityFrameworkCore.EfCoreTenantRepository -> Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1[[Volo.Saas.EntityFrameworkCore.ISaasDbContext, Volo.Saas.EntityFrameworkCore, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null]] -> Volo.Abp.MultiTenancy.MultiTenantConnectionStringResolver.
---> System.MissingMethodException: Method not found: 'Void Microsoft.Extensions.DependencyInjection.ServiceCollectionRegistrationActionExtensions.OnRegistred(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action1<Volo.Abp.DependencyInjection.IOnServiceRegistredContext>)'. at Volo.Abp.AspNetCore.Mvc.UI.Widgets.AbpAspNetCoreMvcUiWidgetsModule.AutoAddWidgets(IServiceCollection services) at Volo.Abp.AspNetCore.Mvc.UI.Widgets.AbpAspNetCoreMvcUiWidgetsModule.PreConfigureServices(ServiceConfigurationContext context) at Volo.Abp.Modularity.AbpModule.PreConfigureServicesAsync(ServiceConfigurationContext context) at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync() --- End of inner exception stack trace --- at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync() at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action
1 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action
1 optionsAction)
at xxx.Blazor.Program.Main(String[] args) in Program.cs:line 36
I have created a new Blazor Server tiered project with abp suite version 7.2.0-rc.1.
After running DbMigrator I started the applications Api.Host, AuthServer and Blazor.
The Blazor application throws an exeption.
I think that in the package Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX => Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared the reference to Volo.Abp.AspNetCore.Mvc.UI.Widgets (v7.1.0) cause it.
Volo.Abp.AbpInitializationException: "An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.AspNetCore.Components.MauiBlazor.AbpAspNetCoreComponentsMauiBlazorModule, Volo.Abp.AspNetCore.Components.MauiBlazor, Version=7.0.2.0, Culture=neutral, PublicKeyToken=null: An error occurred during the ABP remote HTTP request. (Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte. (localhost:44300)) See the inner exception for details.. See the inner exception for details."
Stacktrace: bei Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context) bei Volo.Abp.AbpApplicationBase.InitializeModules() bei Volo.Abp.AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider) bei xxx.MauiBlazor.App.InitializeAbpApplication(IAbpApplicationWithExternalServiceProvider abpApplication, IServiceProvider serviceProvider) in D:\DEV\src\xxxxx.MauiBlazor\App.xaml.cs: Zeile21
InnerException Source Volo.Abp.Http.Client
I created a new application with the cli version 7.1.0-rc.2 and did not make any changes. abp new DemoApp -t app-pro -u maui-blazor --separate-auth-server --with-public-website --no-random-port
After running DbMigrator, the AuthServer, HttpApi.Host and MauiBlazor were started. The MauiBlazor application started but an exception occurs in App.xaml.cs => InitializeAbpApplication.
v7.1.0-rc.2 App.xaml.cs
public App(
IAbpApplicationWithExternalServiceProvider abpApplication,
IServiceProvider serviceProvider)
{
InitializeComponent();
InitializeAbpApplication(abpApplication, serviceProvider);
}
private void InitializeAbpApplication(IAbpApplicationWithExternalServiceProvider abpApplication, IServiceProvider serviceProvider)
{
try
{
abpApplication.Initialize(serviceProvider);
MainPage = new MainPage();
}
catch (AbpInitializationException ex)
{
#if DEBUG
MainPage = GetErrorPage(ex.Message);
#else
MainPage = GetErrorPage("Application couldn't be initialized.");
#endif
}
}
v7.0.2 App.xaml.cs
public App()
{
InitializeComponent();
MainPage = new MainPage();
}
In the template of Version 7.0.1 there was no start problem, the Source of MauiProgram.cs includes this additional lines:
public static MauiApp CreateMauiApp()
{
// snip
var app = builder.Build();
app.Services.GetRequiredService<IAbpApplicationWithExternalServiceProvider>().Initialize(app.Services);
return app;
}
Hello Team,
i have been working with the latest version of abp suite 6.0.0-rc.1 I created a BlazorServer version with LeptonX once tiered and once untiered.
Each with public website and none mobile, EF Core.
The tiered version works as expected but the untiered version throws an error message.
To reproduce this simple create a new solution.
Error handling response: TypeError: Cannot read properties of undefined (reading 'isFixed') at chrome-extension://aajahhgggmjeoanmebkebnikpnfkbejb/js/Content.js:1:31835 localhost/:1 Unchecked runtime.lastError: The message port closed before a response was received.
blazor.server.js?_v=637916820260000000:1 [2022-07-27T13:13:22.399Z] Error: System.NullReferenceException: Object reference not set to an instance of an object. at Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components.ApplicationLayout.SideMenu.Navigation.MobileNavbar.BuildRenderTree(RenderTreeBuilder __builder) at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder) at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException) log @ blazor.server.js?_v=637916820260000000:1
blazor.server.js?_v=637916820260000000:1 Uncaught (in promise) Error: Invocation canceled due to the underlying connection being closed. at kt._connectionClosed (blazor.server.js?_v=637916820260000000:1:72840) at connection.onclose (blazor.server.js?_v=637916820260000000:1:64541) at bt._stopConnection (blazor.server.js?_v=637916820260000000:1:60035) at transport.onclose (blazor.server.js?_v=637916820260000000:1:57773) at vt._close (blazor.server.js?_v=637916820260000000:1:50007) at vt.stop (blazor.server.js?_v=637916820260000000:1:49627) at bt._stopInternal (blazor.server.js?_v=637916820260000000:1:52922) at async bt.stop (blazor.server.js?_v=637916820260000000:1:52732) at async kt.stop (blazor.server.js?_v=637916820260000000:1:67113)
LeptonX version="1.0.0-beta.2" has been configured correctly and works so far. But in the admin area the CmsKitPro switches back to the "old" LeptonTheme when a menu item e.g. "Pages" is selected.
Is it planned that the CmsKitPro becomes more independent of the Lepton Theme or do we have to change the source code ourselves?
New Abp tiered Solution with BlazorServer. Admin with profile picture.
IdentityServer https://localhost:44350/ = ProfileImage visible and reachable. BlazorServer https://localhost:44314/ = ProfileImage not visible
On BlazorServer https://localhost:44314/api/account/profile-picture-file/2b6dba98-da29-e18d-c7d7-3a0063ae3c41 causes Error
Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException: The request matched multiple endpoints. Matches: Volo.Abp.Account.AccountController.GetProfilePictureFileAsync (Volo.Abp.Account.Pro.Public.HttpApi) Volo.Abp.Account.ClientProxies.AccountClientProxy.GetProfilePictureFileAsync (Volo.Abp.Account.Pro.Public.HttpApi.Client)
/_Host at Microsoft.AspNetCore.Routing.Matching.DefaultEndpointSelector.ReportAmbiguity(CandidateState[] candidateState) at Microsoft.AspNetCore.Routing.Matching.DefaultEndpointSelector.ProcessFinalCandidates(HttpContext httpContext, CandidateState[] candidateState) at Microsoft.AspNetCore.Routing.Matching.DefaultEndpointSelector.Select(HttpContext httpContext, CandidateState[] candidateState) at Microsoft.AspNetCore.Routing.Matching.DefaultEndpointSelector.SelectAsync(HttpContext httpContext, CandidateSet candidateSet) at Microsoft.AspNetCore.Routing.Matching.DfaMatcher.SelectEndpointWithPoliciesAsync(HttpContext httpContext, IEndpointSelectorPolicy[] policies, CandidateSet candidateSet) at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>g__AwaitMatch|8_1(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask) at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Accept: image/webp,image/apng,image/svg+xml,image/,/*;q=0.8 Accept-Encoding: gzip, deflate, br Accept-Language: de,de-DE;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6 Cache-Control: no-cache Connection: close Cookie: ai_user=<Snipped> Host: localhost:44314 Pragma: no-cache Referer: https://localhost:44314/ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.34 sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Microsoft Edge";v="96" dnt: 1 sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" sec-fetch-site: same-origin sec-fetch-mode: no-cors sec-fetch-dest: image X-Correlation-Id: 9b9e77f47fe54ae79b4fb2e756dfa5d2