1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo
1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo
1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter2.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonCollectionConverter
2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo
1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter
2.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state) at System.Text.Json.Serialization.JsonConverter
1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
...Hi, the same problem with my,
but I try to add a 'generator' of Nx to wrap schematic of abp,
It works fine because of ignore angular.json check.
You can ref below simple code ,thanksimport { Tree, moveFilesToNewDirectory, generateFiles, joinPathFragments, visitNotIgnoredFiles, ProjectConfiguration } from '@nrwl/devkit'; import { wrapAngularDevkitSchematic } from '@nrwl/devkit/ngcli-adapter'; export default async function (host: Tree, schema: any) { let module=schema.module; let application=schema.application; let directory=schema.directory; let projectType=schema.projectType; let appPath=application;//.replace('-','\\'); let runAngularLibrarySchematic = wrapAngularDevkitSchematic( '@abp/ng.schematics', 'proxy-add' ); await runAngularLibrarySchematic(host, { module: module, source: application, target: application }); if(projectType==='lib'){ await removeProject(host,`libs\\${directory}\\${module}\\proxy\\src\\proxy`); moveFilesToNewDirectory( host, `apps\\${appPath}\\src\\app\\proxy`, `libs\\${directory}\\${module}\\proxy\\src\\proxy` ); } if(projectType==='app'){ moveFilesToNewDirectory( host, `apps\\${appPath}\\src\\app\\proxy`, `apps\\${appPath}\\src\\app\\${module}\\proxy` ); } return () => { console.log(`proxy added '${module} to ${module} success at ${application}`); }; } export function removeProject(tree: Tree, path: string) { visitNotIgnoredFiles(tree, path, (file) => { tree.delete(file); }); //tree.delete(path); }
I have tested the solutions is works without angular.json.
as a workaround, You can create and use your own schematic wrapper. source: https://nx.dev/plugins/recipes/local-generators
Thank you!
Any idea if this can be checked by someone? We're currently stuck upgrading ABP to version 7 since the generate-proxy command doesn't work anymore.
Hi,
We're getting the following error when running the abp generate-proxy command:
> abp generate-proxy -t ng -m platform --target portal-data-access -u https://localhost:44321
ABP CLI 7.1.1
angular.json file not found. You must run this command in the angular folder.
We've upgraded our Angular based Nx workspace to version 15.9.2 which included a Nx migration that removed the angular.json since it is not needed anymore in the mono repo setup. The ABP cli still seems to rely on the angular.json. Is there another option we can use in the command to bypass this error? Something like an output path of the proxy folder?
Related docs:
https://docs.abp.io/en/abp/latest/UI/Angular/Service-Proxies "The command can find application/library roots by reading the angular.json file. Make sure you have either defined your target project as the defaultProject or pass the --target parameter to the command. This also means that you may have a monorepo workspace."
Thank you! In which version will the bug fix be released?
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
If you're creating a bug/problem report, please include followings:
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.Abp.OpenIddict.WildcardDomains.AbpValidateClientRedirectUri.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptions`1[Volo.Abp.OpenIddict.WildcardDomains.AbpOpenIddictWildcardDomainOptions], OpenIddict.Abstractions.IOpenIddictApplicationManager)' on type 'AbpValidateClientRedirectUri'.
---> System.InvalidOperationException: The core services must be registered when enabling the OpenIddict server feature.
To register the OpenIddict core services, reference the 'OpenIddict.Core' package and call 'services.AddOpenIddict().AddCore()' from 'ConfigureServices'.
Alternatively, you can disable the built-in database-based server features by enabling the degraded mode with 'services.AddOpenIddict().AddServer().EnableDegradedMode()'.
at OpenIddict.Server.OpenIddictServerHandlers.Authentication.ValidateClientRedirectUri..ctor()
at Volo.Abp.OpenIddict.WildcardDomains.AbpValidateClientRedirectUri..ctor(IOptions`1 wildcardDomainsOptions, IOpenIddictApplicationManager applicationManager)
at lambda_method503(Closure, Object[])
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass12_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext ctxt, Action`1 next)
at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action`1 next)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.<>c__DisplayClass5_0.<Execute>b__0()
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func`1 creator)
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable`1 qualifyingId, Func`1 creator)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
at OpenIddict.Server.OpenIddictServerDispatcher.<>c__DisplayClass4_0`1.<<DispatchAsync>g__GetHandlersAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
at OpenIddict.Server.OpenIddictServerDispatcher.<>c__DisplayClass4_0`1.<<DispatchAsync>g__GetHandlersAsync|0>d.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at OpenIddict.Server.OpenIddictServerDispatcher.DispatchAsync[TContext](TContext context)
at OpenIddict.Server.OpenIddictServerDispatcher.DispatchAsync[TContext](TContext context)
at OpenIddict.Server.OpenIddictServerHandlers.Authentication.ValidateAuthorizationRequest.HandleAsync(ProcessRequestContext context)
at OpenIddict.Server.OpenIddictServerDispatcher.DispatchAsync[TContext](TContext context)
at OpenIddict.Server.OpenIddictServerDispatcher.DispatchAsync[TContext](TContext context)
at OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandler.HandleRequestAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.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.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
Adding the following configuration to the XHttpApiHostModule, we get the stacktrace on any API request. I've tested this by adding it to a clean startup template of ABP v7.1.1 app and app-pro. This setup was working in v6.0.1. Since this is a DependencyResolutionException maybe there are some missing module dependencies? I also tried to run the sample app https://github.com/abpframework/abp-samples/tree/master/DomainTenantResolver/OpenIddict/NG but had no succes.
public override void ConfigureServices(ServiceConfigurationContext context)
{
...
Configure<AbpTenantResolveOptions>(options =>
{
options.AddDomainTenantResolver("https://{0}.our.app");
});
...
}
public override void PreConfigureServices(ServiceConfigurationContext context)
{
...
PreConfigure<AbpOpenIddictWildcardDomainOptions>(options =>
{
options.EnableWildcardDomainSupport = true;
options.WildcardDomainsFormat.Add("https://{0}.our.app");
});
...
}
Hi
Thanks for confirming. I've overridden the EntityHistoryHelper's GetPropertyChanges method to include the property changes of the referenced entities.
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.Extensions.Options;
using System.Collections.Generic;
using Volo.Abp.Auditing;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EntityFrameworkCore.EntityHistory;
using Volo.Abp.Json;
using Volo.Abp.Timing;
namespace MyCompany.MyModule;
[Dependency(ReplaceServices = true)]
public class CustomEntityHistoryHelper : EntityHistoryHelper
{
public CustomEntityHistoryHelper(
IAuditingStore auditingStore,
IOptions<AbpAuditingOptions> options,
IClock clock,
IJsonSerializer jsonSerializer,
IAuditingHelper auditingHelper)
: base(auditingStore, options, clock, jsonSerializer, auditingHelper)
{
}
protected override List<EntityPropertyChangeInfo> GetPropertyChanges(EntityEntry entityEntry)
{
List<EntityPropertyChangeInfo> propertyChanges = base.GetPropertyChanges(entityEntry);
foreach (ReferenceEntry reference in entityEntry.References)
{
if (reference.TargetEntry == null)
{
continue;
}
List<EntityPropertyChangeInfo> referencePropertyChanges = GetPropertyChanges(reference.TargetEntry);
foreach (EntityPropertyChangeInfo referencePropertyChange in referencePropertyChanges)
{
referencePropertyChange.PropertyName = $"{reference.Metadata.Name}.{referencePropertyChange.PropertyName}";
}
propertyChanges.AddRange(referencePropertyChanges);
}
return propertyChanges;
}
}
Any remarks on this approach?
Is there any way to track entity changes of an owned entity type? https://learn.microsoft.com/en-us/ef/core/modeling/owned-entities
Currently we don't get PropertyChanges in the following scenario:
Entities:
public class Address
{
public string City { get; set; }
public string PostalCode { get; set; }
public string StreetAndNumber { get; set; }
...
}
[Audited]
public class Company : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public string Name { get; set; }
public Address Address { get; set; }
...
}
EFCore DbContext config:
public static void ConfigureModule(this ModelBuilder builder)
{
Check.NotNull(builder, nameof(builder));
builder.Entity<Company>(b =>
{
b.ToTable(ModuleDbProperties.DbTablePrefix + "Companies", ModuleDbProperties.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(CompanyConsts.NameMaxLength);
b.OwnsOne(
x => x.Address,
b =>
{
b.Property(x => x.City).HasMaxLength(AddressConsts.CityMaxLength);
b.Property(x => x.PostalCode).HasMaxLength(AddressConsts.PostalCodeMaxLength);
b.Property(x => x.StreetAndNumber).HasMaxLength(AddressConsts.StreetAndNumberMaxLength);
});
...
});
}
AuditLog auditLog = await _auditLogRepository.GetAsync(...);
EntityChange entityChange = auditLog.EntityChanges.First();
entityChange.PropertyChanges
When updating the company's name and address details, only a property change for the name is generated, not for the address properties. Do we miss some configuration here or is it not supported (yet)? How can we get property changes for the address information?
Thanks in advance!