Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
I have a parent component A that has a child component B. From component B, I am trying to open a modal. The event is registered in component A
In component B, when I am clicking on the button to open the modal, I am calling the following function
showPartsModal(): void { abp.event.trigger('showPartsModal', this.models, this.selectedModels, this.orderId); }
In component A, I have ` ngOnInit() { this.registerToEvents(); }
registerToEvents() { abp.event.on('showPartsModal', (models, selectedModels, orderId) => { this.batchPartsModal.show(selectedModels, selectedModels, orderId); });`
But this event is getting called multiple times when I come back to the page and click on the button after visiting other pages. I found similar issues faced by others in which they suggest we have to unsubscribe to the event so that it does not get called multiple times. But I could not find any example for this.I saw this particular link, https://github.com/aspnetzero/aspnet-zero-core/issues/3929 But still not very sure , how I can implement it for my scenario. Could you please help me out?
Prerequisites
In AspnetZero base code - the Users table in Host and Tenant doesn't look properly aligned. Columns seem to overlap with each other. Can you please let me know how this can be fixed?
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
In AspnetZero base code - side bar is not collapsing properly.
Steps to reproduce:
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
I am getting exception due to HealthChecks in a brand new project!
If I use
"HealthChecks": {
"HealthChecksEnabled": **true**,
"HealthChecksUI": {
"HealthChecksUIEnabled": **true**,
"HealthChecks": [
{
"Name": "MyProd.Web.Host",
"Uri": "https://localhost:44301/health"
}
],
"EvaluationTimeOnSeconds": 10,
"MinimumSecondsBetweenFailureNotifications": 60
}
},
Exception is:
An error occurred while starting the application.
TypeLoadException: Method 'GetServiceProviderHashCode' in type 'ExtensionInfo' from assembly 'Microsoft.EntityFrameworkCore.InMemory, Version=5.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
Microsoft.EntityFrameworkCore.InMemory.Infrastructure.Internal.InMemoryOptionsExtension.get_Info()
ComponentActivatorException: ComponentActivator: could not instantiate HealthChecks.UI.Core.Data.HealthChecksDb
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, object[] arguments, Type implType)
TypeLoadException: Method 'GetServiceProviderHashCode' in type 'ExtensionInfo' from assembly 'Microsoft.EntityFrameworkCore.InMemory, Version=5.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
Microsoft.EntityFrameworkCore.InMemory.Infrastructure.Internal.InMemoryOptionsExtension.get_Info()
Microsoft.EntityFrameworkCore.DbContextOptions.GetHashCode()
System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>.GetOrAdd<TArg>(TKey key, Func<TKey, TArg, TValue> valueFactory, TArg factoryArgument)
Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, bool providerRequired)
Microsoft.EntityFrameworkCore.DbContext..ctor(DbContextOptions options)
lambda_method1208(Closure , object[] )
Castle.Core.Internal.ReflectionUtil.Instantiate(ConstructorInfo ctor, object[] ctorArgs)
Castle.Core.Internal.ReflectionUtil.Instantiate<TBase>(Type subtypeofTBase, object[] ctorArgs)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, object[] arguments, Type implType)
Show raw exception details
ComponentActivatorException: ComponentActivator: could not instantiate HealthChecks.UI.Core.Data.HealthChecksDb
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, object[] arguments, Type implType)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, object[] arguments)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, bool trackedExternally)
Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.<>n__0(CreationContext context, bool trackedExternally)
Castle.MicroKernel.Lifestyle.ScopedLifestyleManager+<>c__DisplayClass4_0.<Resolve>b__0(Action<Burden> afterCreated)
Castle.MicroKernel.Lifestyle.Scoped.DefaultLifetimeScope.GetCachedInstance(ComponentModel model, ScopedInstanceActivationCallback createInstance)
Castle.MicroKernel.Lifestyle.ScopedLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.Windsor.MsDependencyInjection.MsScopedLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, bool requiresDecommission, bool instanceRequired, out Burden burden)
Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, bool instanceRequired)
Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)
Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, bool ignoreParentContext)
Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, bool ignoreParentContext)
Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments)
Castle.Windsor.WindsorContainer.Resolve(Type service)
Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.ResolveInstanceOrNull(Type serviceType, bool isOptional)
Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, bool isOptional)
Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetRequiredService(Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<T>(IServiceProvider provider)
HealthChecks.UI.Core.HostedService.UIInitializationHostedService.InitializeDatabase(IServiceProvider sp)
HealthChecks.UI.Core.HostedService.UIInitializationHostedService.StartAsync(CancellationToken cancellationToken)
Microsoft.AspNetCore.Hosting.HostedServiceExecutor.ExecuteAsync(Func<IHostedService, Task> callback, bool throwOnFirstFailure)
Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, string startupMessage)
Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, string startupMessage)
Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
endurohub.Web.Startup.Program.Main(string[] args) in Program.cs
+
CreateWebHostBuilder(args).Build().Run();
I tried to move to latest version, couple of other changes in appsettings.json, but same issue.
Hi Support team,
Whenever an error occurs in our code, we are adding it into the database table - Alerts.
For Eg: our helper class function is:
public async Task InsertAlert(int tenantId, int orderId, int source, int severity, string message)
{
Alert alert = new Alert() { TenantId = tenantId, OrderId = orderId, Source = source,
Severity = severity, Message = message};
await _alertRepository.InsertAsync(alert).ConfigureAwait(true);
CurrentUnitOfWork.SaveChanges();
}
This is working fine for normal errors, however when exceptions are thrown, Alert will not be saved to DB. We would like to save this entry to Alert table.
Then I have modified the function as shown below to handle both Exception and non-Exception case, but I am not sure it is the best way..
public async Task InsertAlert(int tenantId, int orderId, int source, int severity, string message, bool isThrowingException)
{
Alert alert = new Alert() {TenantId = tenantId, OrderId = orderId, Source = source, Severity = severity, Message = message};
if (isThrowingException)
{
using (var unitOfWork = UnitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
{
await _alertRepository.InsertAsync(alert).ConfigureAwait(true);
unitOfWork.Complete();
}
}
{
using (var unitOfWork = UnitOfWorkManager.Begin())
{
await _alertRepository.InsertAsync(alert).ConfigureAwait(true);
unitOfWork.Complete();
}
}
}
Please let us know what the best practise is to handle this situation.
Product version - 10.4.0 Product type (Angular or MVC)?Angular Product framework type (.net framework or .net core)? .NetCore ABP Framework version? ABP 6.4
Hi Support Team,
I am using a Devextreme component in my application. Its a DateTime picker. Something like in this page https://js.devexpress.com/Demos/WidgetsGallery/Demo/DateBox/Overview/jQuery/Light/ But it is not working properly. When I checked with them, they asked me to make sure that the Date.prototype methods are not overwritten in the project. In my project I see the following code in AppPrebootstrap.ts
private static configureLuxon() {
let luxonLocale = new LocaleMappingService().map(
'luxon',
abp.localization.currentLanguage.name
);
DateTime.local().setLocale(luxonLocale);
DateTime.utc().setLocale(luxonLocale);
if (abp.clock.provider.supportsMultipleTimezone) {
Settings.defaultZoneName = abp.timing.timeZoneInfo.iana.timeZoneId;
}
Date.prototype.toISOString = function () {
let value = DateTime.fromJSDate(this).setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId).toString();
return value;
};
Date.prototype.toString = function () {
let value = DateTime.fromJSDate(this).setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId).toString();
return value;
};
DateTime.prototype.toString = function () {
let date = this.setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId) as DateTime;
return date.toISO();
};
locale(abp.localization.currentLanguage.name);
}
Can you please let me know why the prototype classes are overridden in the above function? I tried commenting the following lines but did not see any changes in the application.
Date.prototype.toISOString = function () {
let value = DateTime.fromJSDate(this).setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId).toString();
return value;
};
Date.prototype.toString = function () {
let value = DateTime.fromJSDate(this).setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId).toString();
return value;
};
DateTime.prototype.toString = function () {
let date = this.setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId) as DateTime;
return date.toISO();
};
Regards
Product version - 10.4.0 Product type (Angular or MVC)?Angular Product framework type (.net framework or .net core)? .NetCore ABP Framework version? ABP 6.4
Hi Support team,
Getting the following exception in Integration Testing:
Castle.MicroKernel.ComponentActivator.ComponentActivatorException: 'ComponentActivator: could not instantiate Hangfire.BackgroundJobClient' Inner Exception: InvalidOperationException: JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.
My Test class:
[DependsOn(typeof(BackgroundJobClient))]
public class MyTest : AppTestBase
{
private readonly IMyAppService _myAppService;
public MyTest()
{
_myAppService = Resolve<IMyAppService>();// Exception here
}
}
My App service:
public class MyAppService : MyAppServiceBase, IMyAppService
{
private readonly IBackgroundJobClient _backgroundJobClient;
public MyAppService(IBackgroundJobClient backgroundJobClient)
{
_backgroundJobClient = backgroundJobClient;
}
public async Task<ResultDto> UpdateMyFile(UpdateMyFileInput input)
{
_backgroundJobClient.Enqueue<MyAppService>(x => x.UpdateMyFileInBackground(_secretBackgroundProcessKey, input, tenantId, userId));
}
}
Exception call stack is:
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)
at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveFromKernelByType(CreationContext context, ComponentModel model, DependencyModel dependency)
at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.TryResolveCore(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency, Object& value)
at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)
at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext)
at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext)
at Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments)
at Castle.Windsor.WindsorContainer.Resolve[T]()
at Abp.TestBase.AbpIntegratedTestBase`1.Resolve[T]()
at My_Tests..ctor() in ...\MyAppHub\server\test\my.Tests\\My_Tests.cs:line 26
Inner exception is:
JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.
Please help.
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
What is the Prettier - Code formatter configuration Asp Net Zero recommend? I checked in the original code in version 10.4, and I can see the following. .prettierrc.json { "printWidth": 120, "singleQuote": true }
But when I apply that in my VSCode, and if I save an Asp Net Zero TS file, it is adding trailingComma, removing blank lines etc, that will make us difficult to merge later to ASP Net Zero code when we upgrade.
Please let me know what are the best practices in applying Prettier - Code formatter configuration to ASP NET ZERO.
Hi Support Team,
While running jobs as a background process in our Production site using HangFire, our users are getting an exception intermittently.
Exception is:
An exception occurred during performance of the job. Abp.UI.UserFriendlyException
[Session.Tenant id is null! Possible problems: No user logged in or current logged in user in a host user (Tenant id is always null for host users).]
Abp.UI.UserFriendlyException: [Session.Tenant id is null! Possible problems: No user logged in or current logged in user in a host user (Tenant id is always null for host users).] at endurohub.Job.JobAppService.RunAutomationStep(Int32 step, Int32 tenantId, Int64 userId, Int32 orderId) in D:\a\1\s\src\endurohub.Application\Job\JobAppService.cs:line 188 at endurohub.Job.JobAppService.UpdateJobFileInBackground(UpdateJobFileInput input, Int32 tenantId, Int64 userId) in D:\a\1\s\src\endurohub.Application\Job\JobAppService.cs:line 169 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Our Code is:
public async Task UpdateJobFile(UpdateJobFileInput input)
{
_backgroundJobClient.Enqueue<JobAppService>(x => x.UpdateJobFileInBackground(input, AbpSession.GetTenantId(), AbpSession.GetUserId()));
}
public async Task UpdateJobFileInBackground(UpdateJobFileInput input, int tenantId, long userId)
{
//Do the job - calling many functions, passing tenantId and userId to those functions
}
Product version - V10.2.0 Product type- Angular Product framework type - .Net Core Hosting - Azure
Please let us know any suggestions.
Hi AspnetZero support team,
Product version -10.2.0 Product type - Angular Product framework type - .Net Core
Facing a problem in 2FA. When user apply 2FA, it works fine for first time. But if user disables the 2FA and re-enables it, then while login it is hitting the exception in TokenAuthController.cs.
throw new UserFriendlyException(L("SendSecurityCodeErrorMessage"));
Since it is problem in CacheManager, if I restart the App/ debugging session, the issue will go off, but again appears if user repeat the steps.
Code is:
public async Task SendTwoFactorAuthCode([FromBody] SendTwoFactorAuthCodeModel model)
{
var cacheKey = new UserIdentifier(AbpSession.TenantId, model.UserId).ToString();
var cacheItem = await _cacheManager
.GetTwoFactorCodeCache()
.GetOrDefaultAsync(cacheKey);
if (cacheItem == null)
{
//There should be a cache item added in Authenticate method! This check is needed to prevent sending unwanted two factor code to users.
throw new UserFriendlyException(L("SendSecurityCodeErrorMessage"));
}
//Continue...
}
Could you please advice?