Hi there,
Unfortunately the issue still exists. Still got NullReferenceException. Why? I checked the documentation and solutions in support forum. I created a custom LookupApiRequestService. See
and
[Extension property in Identity Users not working in Azure #6195](https://abp.io/support/questions/6195/Extension-property-in-Identity-Users-not-working-in-Azure)
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System;
using Volo.Abp.AspNetCore.Components.Web.Extensibility;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client.Authentication;
using Volo.Abp.Http.Client;
using Volo.Abp.MultiTenancy;
namespace NEXTjeugd.Blazor
{
[Dependency(ReplaceServices = true)]
public class CustomBlazorServerLookupApiRequestService : ILookupApiRequestService, ITransientDependency
{
public IHttpClientFactory HttpClientFactory { get; }
public IRemoteServiceHttpClientAuthenticator HttpClientAuthenticator { get; }
public IRemoteServiceConfigurationProvider RemoteServiceConfigurationProvider { get; }
public ICurrentTenant CurrentTenant { get; }
public IHttpContextAccessor HttpContextAccessor { get; }
public NavigationManager NavigationManager { get; }
public ILogger<CustomBlazorServerLookupApiRequestService> Logger { get; }
public CustomBlazorServerLookupApiRequestService(IHttpClientFactory httpClientFactory,
IRemoteServiceHttpClientAuthenticator httpClientAuthenticator,
ICurrentTenant currentTenant,
IHttpContextAccessor httpContextAccessor,
NavigationManager navigationManager,
IRemoteServiceConfigurationProvider remoteServiceConfigurationProvider,
ILogger<CustomBlazorServerLookupApiRequestService> logger)
{
HttpClientFactory = httpClientFactory;
HttpClientAuthenticator = httpClientAuthenticator;
CurrentTenant = currentTenant;
HttpContextAccessor = httpContextAccessor;
NavigationManager = navigationManager;
RemoteServiceConfigurationProvider = remoteServiceConfigurationProvider;
Logger = logger;
}
public async Task<string> SendAsync(string url)
{
var client = HttpClientFactory.CreateClient();
var requestMessage = new HttpRequestMessage(HttpMethod.Get, url);
var uri = new Uri(url, UriKind.RelativeOrAbsolute);
if (!uri.IsAbsoluteUri)
{
var remoteServiceConfig = await RemoteServiceConfigurationProvider.GetConfigurationOrDefaultOrNullAsync("Default");
if (remoteServiceConfig != null)
{
// Blazor tiered mode
var baseUrl = remoteServiceConfig.BaseUrl;
client.BaseAddress = new Uri(baseUrl);
AddHeaders(requestMessage);
await HttpClientAuthenticator.Authenticate(new RemoteServiceHttpClientAuthenticateContext(client, requestMessage, new RemoteServiceConfiguration(baseUrl), string.Empty));
}
else
{
// Blazor server mode
client.BaseAddress = new Uri(NavigationManager.BaseUri);
foreach (var header in HttpContextAccessor.HttpContext!.Request.Headers.Where(x => x.Key != "Accept-Encoding"))
{
requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
}
}
}
var response = await client.SendAsync(requestMessage);
var responseString = await response.Content.ReadAsStringAsync();
Logger.LogInformation("Response: {0}", responseString);
return responseString;
}
protected virtual void AddHeaders(HttpRequestMessage requestMessage)
{
if (CurrentTenant.Id.HasValue)
{
requestMessage.Headers.Add(TenantResolverConsts.DefaultTenantKey, CurrentTenant.Id.Value.ToString());
}
var currentCulture = CultureInfo.CurrentUICulture.Name ?? CultureInfo.CurrentCulture.Name;
if (!currentCulture.IsNullOrEmpty())
{
requestMessage.Headers.AcceptLanguage.Add(new(currentCulture));
}
}
}
}
Is there a solution for this?
ABP Framework version**: v8.2.3 UI Type**: Blazor Server Database System**: EF Core (SQL Server) Tiered (for MVC) Exception message and full stack trace**:
I send all logs to you.
Hi,
According to log.txt file some other exceptions ocurred as well. I can't really explain why they occurred suddenly. A views exceptions:
2024-06-18 09:21:03.649 +00:00 [ERR] Unhandled exception in circuit 'SIhZtD4OOOkA9DL-XkSAqW_d-nKC2hSQ78CMzf6XNwE'. System.TimeoutException: Did not receive any data in the allotted time. at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result) at System.IO.Pipelines.Pipe.GetReadAsyncResult() at System.IO.Pipelines.PipeReaderStream.ReadAsyncInternal(Memory`1 buffer, CancellationToken cancellationToken)
2024-06-18 11:45:46.597 +00:00 [ERR] An exception occurred while iterating over the results of a query for context type 'Volo.Abp.LanguageManagement.EntityFrameworkCore.LanguageManagementDbContext'.
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func
4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync()
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func
4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync()
2024-06-18 11:45:46.609 +00:00 [ERR] Connection id "0HN4FHGOAMROI", Request id "0HN4FHGOAMROI:00000002": An unhandled exception was thrown by the application.
2024-06-18 14:43:17.456 +00:00 [ERR] Unhandled exception in circuit '4NnRogiSjg5nPc_ppDUbJwo5Yyvfa4GPBshS89qJcJA'. System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at Volo.Abp.AspNetCore.Components.Web.Theming.PageToolbars.PageToolbarManager.GetItemsAsync(PageToolbar toolbar) at Volo.Abp.AspNetCore.Components.Web.Theming.Layout.PageHeader.OnParametersSetAsync() at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Do you have any clue why they occurred?
Kind regards, Tako Verkroost
Hi there,
Got this exception sometimes. I can't reproduce it unfortunately.
2024-06-18 05:13:34.809 +00:00 [ERR] Unhandled exception in circuit '0Ii8lf77GLluHYmZrOx5tkCI26mNfhJH2DUyX1YmOpQ'.
System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable
1 parameters)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Volo.Abp.ObjectMapping.DefaultObjectMapper.Map[TSource,TDestination](TSource source)
at Volo.Abp.LanguageManagement.DatabaseLanguageProvider.bDKc3J4YN()
at Volo.Abp.Caching.DistributedCache2.GetOrAddAsync(TCacheKey key, Func
1 factory, Func1 optionsFactory, Nullable
1 hideErrors, Boolean considerUow, CancellationToken token)
at Volo.Abp.LanguageManagement.DatabaseLanguageProvider.GetLanguagesAsync()
at Volo.Abp.AspNetCore.Components.Server.LeptonTheme.LeptonThemeToolbarContributor.ConfigureToolbarAsync(IToolbarConfigurationContext context)
at Volo.Abp.AspNetCore.Components.Web.Theming.Toolbars.ToolbarManager.GetAsync(String name)
at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeaderToolbar.OnInitializedAsync()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
How to fix that?
ABP Framework version**: v5.3.0 UI Type**: Blazor Server Database System**: EF Core (SQL Server) Tiered (for MVC) Exception message and full stack trace**:
Hi there,
Got this exception sometimes. I can't reproduce it unfortunately. Only what I know is getting menu from MainMenuProvider.
Unhandled exception in circuit '0Ii8lf77GLluHYmZrOx5tkCI26mNfhJH2DUyX1YmOpQ'.
System.ObjectDisposedException: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable
1 parameters)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Volo.Abp.SettingManagement.Blazor.Settings.EmailingPageContributor.CheckPermissionsInternalAsync(SettingComponentCreationContext context)
at Volo.Abp.SettingManagement.Blazor.Settings.EmailingPageContributor.CheckPermissionsAsync(SettingComponentCreationContext context)
at Volo.Abp.SettingManagement.Blazor.Menus.SettingManagementMenuContributor.CheckAnyOfPagePermissionsGranted(SettingManagementComponentOptions settingManagementComponentOptions, SettingComponentCreationContext settingComponentCreationContext)
at Volo.Abp.SettingManagement.Blazor.Menus.SettingManagementMenuContributor.ConfigureMainMenuAsync(MenuConfigurationContext context)
at Volo.Abp.SettingManagement.Blazor.Menus.SettingManagementMenuContributor.ConfigureMenuAsync(MenuConfigurationContext context)
at Volo.Abp.UI.Navigation.MenuManager.GetInternalAsync(String name)
at Volo.Abp.UI.Navigation.MenuManager.GetAsync(String[] menuNames)
at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.Navigation.MainMenuProvider.GetMenuAsync()
at NEXTjeugd.Blazor.Components.ApplicationLayout.MainHeader.OnInitializedAsync() in D:\a\1\s\src\NEXTjeugd.Blazor\Components\ApplicationLayout\MainHeader.razor.cs:line 30
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
2024-06-18 05:13:34.802 +00:00 [WRN] Unhandled exception rendering component: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it (or one of its parent scopes) has already been disposed.
Sample code:
How to fix that?
ABP Framework version**: v5.3.0 UI Type**: Blazor Server Database System**: EF Core (SQL Server) Tiered (for MVC) Exception message and full stack trace**:
Hi there,
I got this exception
"Given type (System.String&, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) should be instance of System.Object".
The same error occurred in the early version 5.3.0. Can somebody tell me how to fix that? ABP Framework version**: v8.1.3 UI Type**: Blazor Server Database System**: EF Core (SQL Server) Tiered (for MVC) Exception message and full stack trace**:
2024-06-12 10:59:32.885 +02:00 [ERR] Given type (System.String&, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) should be instance of System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e (Parameter 'item')
System.ArgumentException: Given type (System.String&, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) should be instance of System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e (Parameter 'item')
at Volo.Abp.Collections.TypeList`1.CheckType(Type item)
at Volo.Abp.Collections.TypeList`1.Add(Type item)
at Volo.Abp.Http.Modeling.ApiTypeNameHelper.GetSimpleTypeName(Type type, ITypeList duplicateTypes)
at Volo.Abp.Http.Modeling.ApiTypeNameHelper.GetSimpleTypeName(Type type)
at Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel.Create(ParameterInfo parameterInfo)
at System.Linq.Enumerable.SelectArrayIterator`2.Fill(ReadOnlySpan`1 source, Span`1 destination, Func`2 func)
at System.Linq.Enumerable.SelectArrayIterator`2.ToList()
at Volo.Abp.Http.Modeling.ActionApiDescriptionModel.Create(String uniqueName, MethodInfo method, String url, String httpMethod, IList`1 supportedVersions, Nullable`1 allowAnonymous, String implementFrom)
at Volo.Abp.AspNetCore.Mvc.AspNetCoreApiDescriptionModelProvider.AddApiDescriptionToModel(ApiDescription apiDescription, ApplicationApiDescriptionModel applicationModel, ApplicationApiDescriptionModelRequestDto input)
at Volo.Abp.AspNetCore.Mvc.AspNetCoreApiDescriptionModelProvider.CreateApiModel(ApplicationApiDescriptionModelRequestDto input)
at Volo.Abp.Http.ProxyScripting.ProxyScriptManager.CreateScript(ProxyScriptingModel scriptingModel)
at Volo.Abp.Http.ProxyScripting.ProxyScriptManager.<>c__DisplayClass6_0.<GetScript>b__0()
at System.Collections.Generic.AbpDictionaryExtensions.<>c__DisplayClass7_0`2.<GetOrAdd>b__0(TKey k)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Volo.Abp.Http.ProxyScripting.ProxyScriptManagerCache.GetOrAdd(String key, Func`1 factory)
at Volo.Abp.Http.ProxyScripting.ProxyScriptManager.GetScript(ProxyScriptingModel scriptingModel)
at Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController.GetAll(ServiceProxyGenerationModel model)
at lambda_method6129(Closure, Object, Object[])
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Steps to reproduce the issue**: 1 Start the application 2 Check the log.txt
Hi there,
I have read the documentation about audit log. Each entity is derived from the base class FullAuditedAggregateRoot. I expect each change of an entity should appear in the audit log. As you can see I have configured UseAuditing in my BlazorModule.cs to enable audit logging.
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var env = context.GetEnvironment();
var app = context.GetApplicationBuilder();
var configuration = context.GetConfiguration();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseAbpRequestLocalization();
if (!env.IsDevelopment())
{
app.UseErrorPage();
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseCorrelationId();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseJwtTokenMiddleware();
if (MultiTenancyConsts.IsEnabled)
{
app.UseMultiTenancy();
}
app.UseUnitOfWork();
app.UseIdentityServer();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "NEXTjeugd API");
});
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints();
app.UseWebDav(configuration);
}
I am only getting entries about Volo.Abp.Identity.IdentitySecurityLog which are created, but not changes. Why and how to accomplish that?
Kind regards, Tako Verkroost
ABP Framework version: v5.3.0 UI type: Blazor DB provider: EF Core Exception message and stack trace: Steps to reproduce the issue:"