- ABP Framework version: v5.2.1
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): Micro-Service
- Exception message and stack trace:
- Steps to reproduce the issue:"
=== ENTITY GENERATION STARTED ===
- SOLUTION: CashinIntro.SaasService
- ENTITY:{ "Id": "2ebb6f00-62ae-4438-bc9b-ad172de3a647", "Name": "City", "OriginalName": "City", "NamePlural": "Cities", "DatabaseTableName": "Cities", "Namespace": "Cities", "BaseClass": "FullAuditedAggregateRoot", "PrimaryKeyType": "Guid", "IsMultiTenant": true, "ShouldCreateUserInterface": false, "ShouldCreateBackend": true, "ShouldAddMigration": false, "ShouldUpdateDatabase": false, "CreateTests": true, "Properties": [ { "Id": "4e5a8d37-6b2d-4bf9-9a87-c3d4782f15b2", "Name": "DefaultName", "Type": "string", "EnumType": "", "EnumNamespace": "", "EnumAngularImport": "shared/enums", "IsNullable": false, "IsRequired": true, "MinLength": null, "MaxLength": 255, "SortOrder": 0, "SortType": 0, "Regex": "", "EmailValidation": false, "EnumValues": null, "IsSelected": true } ], "NavigationProperties": [], "NavigationConnections": [], "PhysicalFileName": "City.json" }
2022-04-23 14:50:19.166 +03:00 [INF] 1/8 - EntityGenerateCommand started... 2022-04-23 14:50:20.364 +03:00 [ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": {}, "validationErrors": null }
2022-04-23 14:50:20.371 +03:00 [ERR] StartIndex cannot be less than zero. (Parameter 'startIndex') System.ArgumentOutOfRangeException: StartIndex cannot be less than zero. (Parameter 'startIndex') at System.String.Substring(Int32 startIndex, Int32 length) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.inc2hUYul7(Boolean , String , String ) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.JSQ2I9ONq8(Boolean ) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.khs2SL6OTF() at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.ExecuteAsync(CrudPageCommandOptions options) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.CommandManager.ExecuteAllAsync(CrudPageCommandOptions options) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.CrudPageGenerator.GenerateAsync(EntityModel entity, Solution solution) at Volo.Abp.Suite.Controllers.CrudPageGeneratorController.SaveAndGenerateEntityAsync(Guid solutionId, EntityModel entity) at lambda_method1800(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
Guys what causing the above error ? the error message is not clear if the error was clear it will be more helpful to fix
12 Answer(s)
-
0
Hi @mhdbazcashin,
Suite doesn't support code generation on
AdministrationService,IdentityService&SaasService.However, we are planning to support them as well in future versions.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
It is working on my PC. it is not working on my friend PC. I am able to generate entities however on my friend PC he is not able to generate because he is getting the above error.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
on my PC i was able to generate entities using abo suite on AdministrationService and SaasService. however the above error is happening on my friends PC we are using the same version of abp and save branch
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
I am sure we are both using the 5.2.1 of cli and suite
using CashinIntro.SaasService.StoreSettingGroups; using CashinIntro.SaasService.Cities; using CashinIntro.SaasService.CityTranslations; using CashinIntro.SaasService.Concepts; using CashinIntro.SaasService.ConceptTranslations; using CashinIntro.SaasService.Countries; using CashinIntro.SaasService.CountryTranslations; using CashinIntro.SaasService.Stores; using CashinIntro.SaasService.StoreTags; using CashinIntro.SaasService.StoreTranslations; using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Modeling; using Volo.Payment.EntityFrameworkCore; using Volo.Payment.Plans; using Volo.Payment.Requests; using Volo.Saas.Editions; using Volo.Saas.EntityFrameworkCore; using Volo.Saas.Tenants; namespace CashinIntro.SaasService.EntityFramework; [ConnectionStringName(SaasServiceDbProperties.ConnectionStringName)] public class SaasServiceDbContext : AbpDbContext<SaasServiceDbContext>, ISaasDbContext, IPaymentDbContext { public DbSet<StoreSettingGroup> StoreSettingGroups { get; set; } public SaasServiceDbContext(DbContextOptions<SaasServiceDbContext> options) : base(options) { } public DbSet<ConceptTranslation> ConceptTranslations { get; set; } public DbSet<CityTranslation> CityTranslations { get; set; } public DbSet<City> Cities { get; set; } public DbSet<CountryTranslation> CountryTranslations { get; set; } public DbSet<Country> Countries { get; set; } public DbSet<Store> Stores { get; set; } public DbSet<StoreTranslation> StoreTranslations { get; set; } public DbSet<StoreTag> StoreTags { get; set; } public DbSet<Concept> Concepts { get; set; } public DbSet<PaymentRequest> PaymentRequests { get; set; } public DbSet<Plan> Plans { get; set; } public DbSet<GatewayPlan> GatewayPlans { get; set; } public DbSet<Tenant> Tenants { get; set; } public DbSet<Edition> Editions { get; set; } public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); builder.ConfigureCashinIntroSaas(); /* Define mappings for your custom entities here... modelBuilder.Entity<MyEntity>(b => { b.ToTable(IdentityServiceDbProperties.DbTablePrefix + "MyEntities", IdentityServiceDbProperties.DbSchema); b.ConfigureByConvention(); //TODO: Configure other properties, indexes... etc. }); */ if (builder.IsHostDatabase()) { builder.Entity<Country>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "Country", SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.Property(x => x.DefaultName).HasColumnName(nameof(Country.DefaultName)).IsRequired().HasMaxLength(CountryConsts.DefaultNameMaxLength); }); } builder.Entity<CountryTranslation>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "CountryTranslation", SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.Property(x => x.TenantId).HasColumnName(nameof(CountryTranslation.TenantId)); b.Property(x => x.DisplayName).HasColumnName(nameof(CountryTranslation.DisplayName)).HasMaxLength(CountryTranslationConsts.DisplayNameMaxLength); b.Property(x => x.PrinterName).HasColumnName(nameof(CountryTranslation.PrinterName)).HasMaxLength(CountryTranslationConsts.PrinterNameMaxLength); b.Property(x => x.WebName).HasColumnName(nameof(CountryTranslation.WebName)).HasMaxLength(CountryTranslationConsts.WebNameMaxLength); b.Property(x => x.LanguageId).HasColumnName(nameof(CountryTranslation.LanguageId)); b.HasOne<Country>().WithMany().IsRequired().HasForeignKey(x => x.CoreId); }); builder.Entity<City>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "City", SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.Property(x => x.TenantId).HasColumnName(nameof(City.TenantId)); b.Property(x => x.DefaultName).HasColumnName(nameof(City.DefaultName)).IsRequired().HasMaxLength(CityConsts.DefaultNameMaxLength); }); builder.Entity<CityTranslation>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "CityTranslation", SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.Property(x => x.TenantId).HasColumnName(nameof(CityTranslation.TenantId)); b.Property(x => x.DisplayName).HasColumnName(nameof(CityTranslation.DisplayName)).HasMaxLength(CityTranslationConsts.DisplayNameMaxLength); b.Property(x => x.PrinterName).HasColumnName(nameof(CityTranslation.PrinterName)).HasMaxLength(CityTranslationConsts.PrinterNameMaxLength); b.Property(x => x.WebName).HasColumnName(nameof(CityTranslation.WebName)).HasMaxLength(CityTranslationConsts.WebNameMaxLength); b.Property(x => x.LanguageId).HasColumnName(nameof(CityTranslation.LanguageId)); b.HasOne<City>().WithMany().IsRequired().HasForeignKey(x => x.CoreId); }); builder.Entity<Concept>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "Concept", SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.Property(x => x.TenantId).HasColumnName(nameof(Concept.TenantId)); b.Property(x => x.DefaultName).HasColumnName(nameof(Concept.DefaultName)).IsRequired().HasMaxLength(ConceptConsts.DefaultNameMaxLength); }); builder.Entity<ConceptTranslation>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "ConceptTranslation", SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.Property(x => x.TenantId).HasColumnName(nameof(ConceptTranslation.TenantId)); b.Property(x => x.DisplayName).HasColumnName(nameof(ConceptTranslation.DisplayName)).HasMaxLength(ConceptTranslationConsts.DisplayNameMaxLength); b.Property(x => x.PrinterName).HasColumnName(nameof(ConceptTranslation.PrinterName)).HasMaxLength(ConceptTranslationConsts.PrinterNameMaxLength); b.Property(x => x.WebName).HasColumnName(nameof(ConceptTranslation.WebName)).HasMaxLength(ConceptTranslationConsts.WebNameMaxLength); b.Property(x => x.LanguageId).HasColumnName(nameof(ConceptTranslation.LanguageId)); b.HasOne<Concept>().WithMany().IsRequired().HasForeignKey(x => x.CoreId); }); builder.Entity<StoreTranslation>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "StoreTranslation", SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.Property(x => x.TenantId).HasColumnName(nameof(StoreTranslation.TenantId)); b.Property(x => x.DisplayName).HasColumnName(nameof(StoreTranslation.DisplayName)).HasMaxLength(StoreTranslationConsts.DisplayNameMaxLength); b.Property(x => x.PrinterName).HasColumnName(nameof(StoreTranslation.PrinterName)).HasMaxLength(StoreTranslationConsts.PrinterNameMaxLength); b.Property(x => x.WebName).HasColumnName(nameof(StoreTranslation.WebName)).HasMaxLength(StoreTranslationConsts.WebNameMaxLength); b.Property(x => x.LanguageId).HasColumnName(nameof(StoreTranslation.LanguageId)); b.Property(x => x.Address).HasColumnName(nameof(StoreTranslation.Address)).HasMaxLength(StoreTranslationConsts.AddressMaxLength); b.HasOne<Store>().WithMany().IsRequired().HasForeignKey(x => x.CoreId); }); builder.Entity<StoreTag>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "StoreTag", SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.Property(x => x.TenantId).HasColumnName(nameof(StoreTag.TenantId)); b.Property(x => x.Name).HasColumnName(nameof(StoreTag.Name)).IsRequired().HasMaxLength(StoreTagConsts.NameMaxLength); }); builder.Entity<Store>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "Stores", SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.Property(x => x.TenantId).HasColumnName(nameof(Store.TenantId)); b.Property(x => x.DefaultName).HasColumnName(nameof(Store.DefaultName)).IsRequired().HasMaxLength(StoreConsts.DefaultNameMaxLength); b.Property(x => x.StoreId).HasColumnName(nameof(Store.StoreId)).HasMaxLength(StoreConsts.StoreIdMaxLength); b.Property(x => x.ReferenceId).HasColumnName(nameof(Store.ReferenceId)).HasMaxLength(StoreConsts.ReferenceIdMaxLength); b.Property(x => x.Address).HasColumnName(nameof(Store.Address)).HasMaxLength(StoreConsts.AddressMaxLength); b.Property(x => x.Telephone).HasColumnName(nameof(Store.Telephone)).HasMaxLength(StoreConsts.TelephoneMaxLength); b.Property(x => x.State).HasColumnName(nameof(Store.State)).HasMaxLength(StoreConsts.StateMaxLength); b.Property(x => x.PostalCode).HasColumnName(nameof(Store.PostalCode)).HasMaxLength(StoreConsts.PostalCodeMaxLength); b.Property(x => x.GeoFencing).HasColumnName(nameof(Store.GeoFencing)).HasMaxLength(StoreConsts.GeoFencingMaxLength); b.Property(x => x.Location).HasColumnName(nameof(Store.Location)).HasMaxLength(StoreConsts.LocationMaxLength); b.Property(x => x.Status).HasColumnName(nameof(Store.Status)).IsRequired(); b.Property(x => x.OpenTime).HasColumnName(nameof(Store.OpenTime)); b.Property(x => x.CloseTime).HasColumnName(nameof(Store.CloseTime)); b.Property(x => x.CloseTimeNextDay).HasColumnName(nameof(Store.CloseTimeNextDay)); b.Property(x => x.Mobile).HasColumnName(nameof(Store.Mobile)).HasMaxLength(StoreConsts.MobileMaxLength); b.HasOne<City>().WithMany().IsRequired().HasForeignKey(x => x.CityId); b.HasOne<Country>().WithMany().IsRequired().HasForeignKey(x => x.CountryId); b.HasOne<Concept>().WithMany().IsRequired().HasForeignKey(x => x.ConceptId); b.HasMany(x => x.StoreTags).WithOne().HasForeignKey(x => x.StoreId).IsRequired(); }); builder.Entity<StoreStoreTag>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "StoreStoreTag" + SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); //define composite key b.HasKey( x => new { x.StoreId, x.StoreTagId } ); //many-to-many configuration b.HasOne<Store>().WithMany(x => x.StoreTags).HasForeignKey(x => x.StoreId).IsRequired(); b.HasOne<StoreTag>().WithMany().HasForeignKey(x => x.StoreTagId).IsRequired(); b.HasIndex( x => new { x.StoreId, x.StoreTagId } ); }); builder.Entity<StoreSettingGroup>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "StoreSettingGroup", SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.Property(x => x.TenantId).HasColumnName(nameof(StoreSettingGroup.TenantId)); b.Property(x => x.Name).HasColumnName(nameof(StoreSettingGroup.Name)).IsRequired().HasMaxLength(StoreSettingGroupConsts.NameMaxLength); b.HasMany(x => x.Stores).WithOne().HasForeignKey(x => x.StoreSettingGroupId).IsRequired().OnDelete(DeleteBehavior.NoAction); }); builder.Entity<StoreSettingGroupStore>(b => { b.ToTable(SaasServiceDbProperties.DbTablePrefix + "StoreSettingGroupStore" + SaasServiceDbProperties.DbSchema); b.ConfigureByConvention(); b.HasKey( x => new { x.StoreSettingGroupId, x.StoreId } ); b.HasOne<StoreSettingGroup>().WithMany(x => x.Stores).HasForeignKey(x => x.StoreSettingGroupId).IsRequired().OnDelete(DeleteBehavior.NoAction); b.HasOne<Store>().WithMany().HasForeignKey(x => x.StoreId).IsRequired().OnDelete(DeleteBehavior.NoAction); b.HasIndex( x => new { x.StoreSettingGroupId, x.StoreId } ); }); } }Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
@yekalkan I can provide team viewer to my PC if that will help you investigating the issue
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
To clarify; You and your coworker has exactly the same files (same branch), but Suite doesn't work for him. Am i right?
Error message says: It couldn't find
OnModelCreatingmethod in theDbContextfile. It is weird if you are using the exactly same files.Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
We tried everything possible
- Remove the solution from abp suite then add it again
- Uninstall abp suite install again
- Uninstall abp cli and abp suite and install again
- Delete %UserProfile%.abp\suite\
- Nothing solved it
Yes we were testing on the master branch and code is same. strange. we are 3 developers suite was working on my machine only both of my co worker were have the same error
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
To reproduce the issue; i created a microservice solution, and added SaasService to AbpSuite. Then tried to generate CRUD page, but encountered several errors. I don't know what you have done to make it work with Suite. I said in the first reply, Suite doesn't support this officially. So we can't help you with that.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
OK can you refund the ticket please
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)