Base solution for your next web application

Activities of "bluescopesteel"

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 11.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)?.net core

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 Ismcagdas,

Sorry for the late respose, I think your solution 2 is working fine. Thanks v much.

  • What is your product version? - 10.04
  • What is your product type (Angular or MVC)? - Angular
  • What is product framework type (.net framework or .net core)? - .net core

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.

Prerequisites

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

Hi @ismcagdas,

Thanks v much for your reply.

I saw this link before, but that suggestion didn't work, so I moved the required APIs to another service to resolve this issue for the time being. I will try your suggestion once again when I need to write tests on the Service which has Hangfire included.

Thanks v much once again.

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.

Hi @ismcagdas,

Thanks v much, Issue is created for this.

Best regards, Bluescope team

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 10.4
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

If issue related with ABP Framework

  • What is ABP Framework version? - NA

If issue is about UI

  • Which theme are you using? NA
  • What are the theme settings? NA

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,

Please ignore this ticket for time being.I guess it is problem of calling AbpSession.GetTenantId() on background functions in a specific scenario.

Best regards

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.

Showing 11 to 20 of 43 entries