I am using this right now and it solves my issue:
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(LocalizableStringSerializer), typeof(ILocalizableStringSerializer), typeof(FixedLocalizableStringSerializer))]
public class FixedLocalizableStringSerializer(IOptions<AbpLocalizationOptions> localizationOptions) : LocalizableStringSerializer(localizationOptions), ITransientDependency
{
public override ILocalizableString Deserialize(string? value)
{
if (value == null)
{
return new FixedLocalizableString("");
}
return base.Deserialize(value);
}
}
is there a problem with my workaround ?
The bug described here: https://github.com/abpframework/abp/issues/21191
Is causing our production app to fail Please provide us with a workaround until it's fixed
So which one is correct, OnPreApplicationInitializationAsync
or OnPostApplicationInitializationAsync
?
because the generated files contains a templates/service_nolayers
template that uses OnPostApplicationInitializationAsync
public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context)
{
using var scope = context.ServiceProvider.CreateScope();
{{~ if config.database_provider == "ef" ~}}
await scope.ServiceProvider
.GetRequiredService<MicroserviceNameRuntimeDatabaseMigrator>()
.CheckAndApplyDatabaseMigrationsAsync();
{{~ else if config.database_provider == "mongodb" ~}}
await scope.ServiceProvider
.GetRequiredService<MicroserviceNameDataSeeder>()
.SeedAsync();
{{~ end~}}
}
I see, but I noticed that the given example in the identity service is different from the docs
Generated from template, uses OnPreApplicationInitializationAsync
public override async Task OnPreApplicationInitializationAsync(ApplicationInitializationContext context)
{
using var scope = context.ServiceProvider.CreateScope();
await scope.ServiceProvider
.GetRequiredService<IdentityServiceRuntimeDatabaseMigrator>()
.CheckAndApplyDatabaseMigrationsAsync();
}
Referenced in docs uses OnPostApplicationInitializationAsync
:
public override async Task
OnPostApplicationInitializationAsync(ApplicationInitializationContext context)
{
using var scope = context.ServiceProvider.CreateScope();
await scope.ServiceProvider
.GetRequiredService<IdentityServiceRuntimeDatabaseMigrator>()
.CheckAndApplyDatabaseMigrationsAsync();
}
I generated a new microservice solution on the latest version of the CLI, but I noticed some patterns have changed from the old template (e.g. removal of DbMigrator project), mainly what I am asking about here is the per-service data seeder, e.g.:
public class MicroserviceNameDataSeeder : ITransientDependency
{
private readonly ILogger<MicroserviceNameDataSeeder> _logger;
public MicroserviceNameDataSeeder(
ILogger<MicroserviceNameDataSeeder> logger)
{
_logger = logger;
}
public async Task SeedAsync(Guid? tenantId = null)
{
_logger.LogInformation("Seeding data...");
//...
}
}
As you can see, it does not use IDataSeeder
anymore, is it a bad practice to use it here ? do we need to inject + call each data seed contributor manually from all the dependent modules ?
in local development (on localhost
)
calling
app.UseAbpStudioLink();
seems to not work very well with stream-based grpc requests (like grpc reflection API for example)
the server is able to receive requests, but can't send back any response.
I am guessing the middleware inserted by UseAbpStudioLink
waits for the request to finish then sends the response, which contradicts how grpc streaming works.
hi mailming, yes i realize that, but what I am asking is why? I can already run the tests via dotnet test, why can't I debug them ?
our use case is that we have a separate test writing team that is NOT part of our organization, so they can't login, as they don't have active seats.
Since we already pay for Enterprise plan, and have access to the source code, I expect that we can use it however we want.
TLDR: running tests in debug mode crashes, running them via dotnet test
works.
Running tests that depend on pro modules in debug mode fails (crashes testhost.exe
) if we don't login using abp login
before debugging tests.
Simple reproduction:
var licenseCode = "Valid license code here";
SaasDomainModule.LicenseChecker.Check<...>(licenseCode, isDevelopment: true)
%UserProfile%\.abp\cli\access-token.bin
is not available), it just crashes the test host.isDevelopment: false
, it works regardless of authentication status.This is problematic for us, since we want to be able to debug tests in vs test explorer (which sets isDevelopment: true
) while only providing licenseCode
via appsettings.secrets.json
Abp version: 8.1.0
Abp CLI version: 8.1.3
We had an outdated package.json
, once we updated it and re-run abp install-libs
, it was solved.
We have a microservice template deployed on azure, and when we access the /Account/Manage page under the auth server app we get the following logs:
[17:32:53 INF] Request starting HTTP/1.1 GET http://account.my-website.cloud/Account/Manage - null null
[17:32:53 INF] Executing endpoint '/Account/Manage'
[17:32:53 INF] Route matched with {page = "/Account/Manage", area = "", action = "", controller = ""}. Executing page /Account/Manage
[17:32:53 INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy
[17:32:53 INF] Executing handler method Volo.Abp.Account.Public.Web.Pages.Account.ManageModel.OnGetAsync - ModelState is Valid
[17:32:53 INF] Executed handler method OnGetAsync, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult.
[17:32:54 INF] Bundling __bundles/Volo.Abp.Account.Public.Web.Pages.Account.ManageModel.0D7BDD6F53B06C5D824B77DF463FBB2F.js (11 files)
[17:32:54 INF] > Minified /Pages/Account/PasswordComplexityIndicator.js (2391 bytes -> 1236 bytes)
[17:32:54 INF] > Minified /Pages/Account/Components/ProfileManagementGroup/Password/Default.js (1797 bytes -> 959 bytes)
[17:32:54 INF] > Minified /Pages/Account/Components/ProfileManagementGroup/ProfilePicture/Default.js (6482 bytes -> 2344 bytes)
[17:32:54 INF] > Minified /Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js (5775 bytes -> 2746 bytes)
[17:32:54 INF] > Minified /Pages/Account/Components/ProfileManagementGroup/AuthenticatorApp/Default.js (3378 bytes -> 1850 bytes)
[17:32:54 INF] > Minified /Pages/Account/Components/ProfileManagementGroup/TwoFactor/Default.js (501 bytes -> 270 bytes)
[17:32:54 INF] > Minified /Pages/Account/Manage.js (250 bytes -> 131 bytes)
[17:32:54 INF] Executed page /Account/Manage in 424.8588ms
[17:32:54 INF] Executed endpoint '/Account/Manage'
[17:32:54 ERR] An unhandled exception has occurred while executing the request.
Volo.Abp.AbpException: Could not find file '/libs/zxcvbn/zxcvbn.js'
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundlerBase.GetFileInfo(IBundlerContext context, String file)
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundlerBase.GetAndMinifyFileContent(IBundlerContext context, String fileName)
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundlerBase.GetFileContentConsideringMinification(IBundlerContext context, String fileName)
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundlerBase.AddFileToBundle(IBundlerContext context, StringBuilder bundleContentBuilder, String fileName)
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundlerBase.Bundle(IBundlerContext context)
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundleManager.<>c__DisplayClass17_0.<AddToBundleCache>b__0()
at System.Collections.Generic.AbpDictionaryExtensions.<>c__DisplayClass7_0`2.<GetOrAdd>b__0(TKey k)
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundleManager.GetBundleFilesAsync(BundleConfigurationCollection bundles, String bundleName, IBundler bundler)
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundleManager.GetScriptBundleFilesAsync(String bundleName)
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpTagHelperScriptService.GetBundleFilesAsync(String bundleName)
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpTagHelperResourceService.ProcessAsync(ViewContext viewContext, TagHelper tagHelper, TagHelperContext context, TagHelperOutput output, List`1 bundleItems, String bundleName)
at Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpBundleTagHelperService`2.ProcessAsync(TagHelperContext context, TagHelperOutput output)
at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, Int32 i, Int32 count)
at AspNetCoreGeneratedDocument.Pages_Account_Manage.<ExecuteAsync>b__16_1()
at Microsoft.AspNetCore.Mvc.Razor.RazorPage.RenderSectionAsyncCore(String sectionName, Boolean required)
at tLCUksq2Eol74xhFRIb.eC8FAXqXPCAfLI4Eigl.<>c__DisplayClass21_0.fDpcqmywwd7kXmOEH5u.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
at tLCUksq2Eol74xhFRIb.eC8FAXqXPCAfLI4Eigl.ExecuteAsync()
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultFilters>g__Awaited|28_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Builder.ApplicationBuilderAbpOpenIddictMiddlewareExtension.<>c__DisplayClass0_0.<<UseAbpOpenIddictValidation>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Prometheus.HttpMetrics.HttpRequestDurationMiddleware.Invoke(HttpContext context)
at Prometheus.HttpMetrics.HttpRequestCountMiddleware.Invoke(HttpContext context)
at Prometheus.HttpMetrics.HttpInProgressMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
[17:32:54 INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)'
[17:32:54 INF] Route matched with {action = "Index", controller = "Error", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Index(Int32) on controller Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared).
[17:32:54 INF] Executing ViewResult, running view ~/Views/Error/500.cshtml.
[17:32:54 INF] Executed ViewResult - view ~/Views/Error/500.cshtml executed in 14.0889ms.
[17:32:54 INF] Executed action Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared) in 17.5901ms
[17:32:54 INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)'
[17:32:54 INF] Request finished HTTP/1.1 GET https://account.my-website.cloud/Account/Manage - 500 null text/html; charset=utf-8 527.2189ms
We tried running abp install-libs
, it didn't solve the issue