Open Closed

Value cannot be null. (Parameter 'ExtraProperties') #5600


User avatar
0
Sergei.Gorlovetsky created
  • ABP Framework version: v7.3.2
  • UI Type: Angular
  • Database System: MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace: [ERR] Value cannot be null. (Parameter 'ExtraProperties') System.ArgumentNullException: Value cannot be null. (Parameter 'ExtraProperties') at Volo.Abp.Check.NotNull[T](T value, String parameterName) at Volo.Abp.ObjectExtending.ExtensibleObjectMapper.MapExtraPropertiesTo[TSource,TDestination](TSource source, TDestination destination, Nullable1 definitionChecks, String[] ignoredProperties) at Volo.Abp.ObjectExtending.HasExtraPropertiesObjectExtendingExtensions.MapExtraPropertiesTo[TSource,TDestination](TSource source, TDestination destination, Nullable1 definitionChecks, String[] ignoredProperties) at Volo.Payment.Admin.Plans.PlanAdminAppService.UpdateAsync(Guid id, PlanUpdateInput input)
  • Steps to reproduce the issue: Updated solution to latest version 7.3.2, we have added Volo.Payment.Admin module in Identity Server web application, when trying to edit Payment Plan it gives the above error, before update it was working properly. We have added CMSKit module also in same Identity Server web application and it that module too, for Blogs, Menu module in edit getting same error.

We have the code in Azure DevOps, if you need access to the repository, please share the email.


20 Answer(s)
  • User Avatar
    0
    Sergei.Gorlovetsky created

    Dear Anjali_Musmade, Please advise how to proceed with this issue. Thanks, Sergei

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello Sergei,

    Apologies for the delay in response. We are working on the solution and will get back to you on soon.

    Thank you, Anjali

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi

    we have integrated CMS and Payment Module in Identity server web application but not able to reproduce the issue

    In AuthServer In AuthServer

    In Public

    In AuthServer

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi,

    I hope in your identity server module you have these module listed on dependson.

  • User Avatar
    0
    Sergei.Gorlovetsky created

    We have checked the modules listed on dependson and all seems ok, did you try editing the Blog and Payment Plan record? Addition works properly, the issue is in Edit only.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi,

    Yes editing also works

    see below video

    https://aman-waiin.tinytake.com/df/14f12ff/thumbnail?type=attachments&version_no=0&file_version_no=0&thumbnail_size=preview

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi,

    if you want to share your solution so we can have a look at the issue please share to support@abp.io with mentioning the ticket number.

  • User Avatar
    0
    Sergei.Gorlovetsky created

    Hello,

    It will be difficult to send the whole solution, we have the devops repository setup and the latest code is there in repository, can you give a login which we can add to devops repository, so that you can access the repository and code.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello Sergei.Gorlovetsky,

    Apologies for the delay in response. PFB our username for Github and share the required access: anjalimus Please do let me know if anything else is needed.

    Thank You, Anjali

  • User Avatar
    0
    Sergei.Gorlovetsky created

    Hi Anjali My apology for confusion. I meant to say that this project is not managed in github but in Microsoft Azure DevOps. In order to allow you access to the source code we have to add your work email to the system. Please share your work email. I hope it make sense to you. Thanks, Sergei

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello Sergei.Gorlovetsky,

    Its alright, PFB my work email and share the required access:

    anjali.musmade@waiin.com

    Please do let me know if anything else is needed.

    Thank You, Anjali

  • User Avatar
    0
    Sergei.Gorlovetsky created

    Hello Anjali, Your user have been invited to the repo. Pls accept the invite and access the repo here: https://dev.azure.com/DecisionTreeTech/_git/ClientelePortal

    Let me know if you have any permissions issues with the branch.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello Sergei.Gorlovetsky,

    Thank you l got the access, we will check and get back to you asap.

    Thank you, Anjali

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello Sergei.Gorlovetsky,

    I apologies for delay in response, Actually the issue is at our side.

    For time being please add below code:-

    Create a AppBsonClassMapSerializer class in {Projectname}.MongoDB and add this code

    using MongoDB.Bson.Serialization;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Reflection;
    using System.Text;
    using System.Threading.Tasks;
    using Volo.Abp.Data;
    using Volo.Abp.Domain.Entities;
    namespace {ProjectName}.MongoDb
    {
        public class AppBsonClassMapSerializer< TClass > : BsonClassMapSerializer< TClass >, IBsonDocumentSerializer
        {
            public AppBsonClassMapSerializer(BsonClassMap classMap) : base(classMap)
            {
            }
            public override TClass Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
            {
                var result = base.Deserialize(context, args);
                try
                {
                    Type type = result.GetType();
                    if (type == null)
                    {
                        return result;
                    }
                    PropertyInfo propertyInfo = type.GetProperty(nameof(AggregateRoot.ExtraProperties));
                    if (propertyInfo != null && propertyInfo.CanWrite)
                    {
                        if (propertyInfo.GetValue(result) == null)
                        {
                            propertyInfo.SetValue(result, new ExtraPropertyDictionary());
                        }
                    }
                    return result;
                }
                catch (Exception)
                {
                    return result;
                }
            }
        }
        public class AppBsonSerializationProvider : IBsonSerializationProvider
        {
            public IBsonSerializer GetSerializer(Type type)
            {
                if (type.BaseType == typeof(Volo.Abp.Domain.Entities.Auditing.FullAuditedAggregateRoot<Guid>))
                {
                    Type serializerType = typeof(AppBsonClassMapSerializer<>).MakeGenericType(type);
                    return (IBsonSerializer)Activator.CreateInstance(serializerType, BsonClassMap.LookupClassMap(type));
                }
                return null;
            }
        }
    }
    
    

    Add BsonSerializer.RegisterSerializationProvider(new AppBsonSerializationProvider()); into {Projectname}MongoDbModule.cs

    We will fix it in next version and your ticket will be refunded. Can we close this ticket if your query is resolved? Please confirm.

    Awaiting for your valuable response.

    Thank You, Anjali

  • User Avatar
    0
    Sergei.Gorlovetsky created

    Hello Anjali,

    We tried adding the class and suggested code in {Projectname}MongoDbModule.cs but that didn't solve the issue, still we are getting same error as before. Can you check the latest commit in devops repository and verify the code changes.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi @Sergei.Gorlovetsky,

    Please replace previous code for AppBsonSerializationProvider class with following code, i have tested it on your project, edit is now working

     public class AppBsonSerializationProvider : IBsonSerializationProvider
     {
         public IBsonSerializer GetSerializer(Type type)
         {
           
             if ((type?.BaseType?.FullName.Contains(typeof(Volo.Abp.Domain.Entities.Auditing.FullAuditedAggregateRoot)?.FullName)).GetValueOrDefault())
             {
                 Type serializerType = typeof(AppBsonClassMapSerializer<>).MakeGenericType(type);
                 return (IBsonSerializer)Activator.CreateInstance(serializerType, BsonClassMap.LookupClassMap(type));
             }
    
             return null;
         }
     }
    
  • User Avatar
    0
    Sergei.Gorlovetsky created

    Hello Anjali,

    Thanks for the quick reply, the last code fixed the Blog & Payment Plan edit issue, now I think only CMS Kit => Menu Items edit getting error as below

    [ERR] Value cannot be null. (Parameter 'ExtraProperties') System.ArgumentNullException: Value cannot be null. (Parameter 'ExtraProperties') at Volo.Abp.Check.NotNull[T](T value, String parameterName) at Volo.Abp.ObjectExtending.ExtensibleObjectMapper.MapExtraPropertiesTo[TSource,TDestination](TSource source, TDestination destination, Nullable1 definitionChecks, String[] ignoredProperties) at Volo.Abp.ObjectExtending.HasExtraPropertiesObjectExtendingExtensions.MapExtraPropertiesTo[TSource,TDestination](TSource source, TDestination destination, Nullable1 definitionChecks, String[] ignoredProperties) at Volo.CmsKit.Admin.Menus.MenuItemAdminAppService.UpdateAsync(Guid id, MenuItemUpdateInput input)

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi

    I have made the changes Please replace previous code for AppBsonSerializationProvider class with following code, i have tested it on menu item, edit is now working

     public class AppBsonSerializationProvider : IBsonSerializationProvider
     {
         public IBsonSerializer GetSerializer(Type type)
         {
             Console.WriteLine(type?.FullName);
             if ((type?.GetProperty(nameof(AggregateRoot.ExtraProperties)) != null) && type?.GetConstructor(Type.EmptyTypes) == null)
             {
                 Type serializerType = typeof(AppBsonClassMapSerializer<>).MakeGenericType(type);
                 return (IBsonSerializer)Activator.CreateInstance(serializerType, BsonClassMap.LookupClassMap(type));
             }
    
             return null;
         }
     }
    

    This is issue has been logged please check here https://github.com/abpframework/abp/issues/17521 you can remove the above code when you have upgraded abp 7.4 and test

  • User Avatar
    0
    Sergei.Gorlovetsky created

    Hi, After applying the last fix, it seems all working now, thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi https://github.com/abpframework/abp/pull/17534

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11