Bug Report T583980
Visible to All Users

Core - Obscure exceptions may occur when the Application Model element's member or type info are non-existent

created 7 years ago

Der Wert darf nicht NULL sein.
Parametername: member.MemberInfo

https://www.devexpress.com/Support/Center/Question/Details/Q502593/value-cannot-be-null-parameter-name-member-memberinfo

My question is similiar how to identify such a problem?
How to find this Properties or Rules?

Show previous comments (10)
Dennis Garavsky (DevExpress) 7 years ago

    Hello Wolfram,

    Thank you for your answers. I admit that debugging this problem in a production app with a client database can be problematic.

    >>Ok, is this the reason that wrong rules throw a ReportsV2 exception? Even it has nothing todo with this module?
    The reason that you receive this error the ReportV2 module is just a coincidence, because this module checks data for validity. We received similar reports in the past (
    https://search.devexpress.com/?q=FillRelatedTypes&f=&m=SupportCenter) and we will see if we can introduce a meaningful diagnostic message to at least let you guys determine problematic classes and members without debugging. At first glance, this should not be difficult.

    WW WW
    Wolfram Windisch 7 years ago

      It happens exactly here.
      And here you have every data to log a proper Errormessage…

      ReportExtension.cs

      private static void FillRelatedTypes(IModelClass modelClass, IModelBOModel modelBOModel, IDictionary<Type, string> result, bool includeEnums, ITypesInfo typesInfo) {
         foreach(IModelMember member in modelClass.AllMembers) {
          Guard.ArgumentNotNull(member.MemberInfo, "member.MemberInfo");
          Guard.ArgumentNotNull(member.MemberInfo.MemberTypeInfo, "member.MemberInfo.MemberTypeInfo");
          Guard.ArgumentNotNull(member.Type, "member.Type");
          ITypeInfo typeInfo = typesInfo.FindTypeInfo(member.Type);
          Type memberType = typeInfo.Type;
          if(member.MemberInfo.MemberTypeInfo.IsDomainComponent && member.MemberInfo.MemberTypeInfo.IsPersistent) {
           if(!result.ContainsKey(memberType)) {
            IModelClass currentMemberModelClass = modelBOModel.GetClass(memberType);
            result.Add(currentMemberModelClass.TypeInfo.Type, currentMemberModelClass.Caption);
            FillRelatedTypes(currentMemberModelClass, modelBOModel, result, includeEnums, typesInfo);
           }
          }
          if(includeEnums && memberType.IsEnum) {
           if(!result.ContainsKey(memberType)) {
            result.Add(memberType, CaptionHelper.GetLocalizedText("Enums", memberType.FullName, memberType.Name));
           }
          }
         }
        }

      Dennis Garavsky (DevExpress) 7 years ago

        Yes, that is the XtraReportDataTypeProvider.FillRelatedTypes method I also meant above.

        Answers approved by DevExpress Support

        created 7 years ago (modified 7 years ago)

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

        Additional information:

        Starting with v18.1, we have introduced checks for type and member info existence at the core level. If a type or member is not existent, the exception will be thrown by default:

        NOTE:  Type and member info is mandatory as ALL standard and third-party modules rely on it. We do NOT recommend disabling this check in production, because your application will still fail later (you may not notice it and it will happen on an end-user machine).

        Typical but not all scenarios where you may see this error are:
        - Code changes to an underlying object type structure. For instance, class renaming or removing, namespace or assembly changing; member renaming, removing or its underlying type changing (also applied to custom fields added at runtime).
        - Invalid model differences for changed types and members are still present (e.g., for ListView columns and a DetailView layout, appearance and validation rules).

        Possible ways to handle these consequences are described below:
            Task-Based Help > How to: Handle Renamings and Deletions of Business Classes and their Properties
            Graceful way to handle bad user diff models

        How to disable this behavior?
        Disabling this check may be useful only temporarily, in a development environment for troubleshooting the aforementioned issues. You can set the static ApplicationModelManager.RaiseExceptionOnRequiredProperty property to False in the YourSolutionName.Module/Module.xx file:

        C#
        ... using DevExpress.ExpressApp; namespace MainDemo.Module { public sealed partial class MainDemoModule : ModuleBase { public MainDemoModule() { InitializeComponent(); ApplicationModelManager.RaiseExceptionOnRequiredProperty = false; ...
        Visual Basic
        '... Imports DevExpress.ExpressApp Namespace MainDemo.Module Public NotInheritable Partial Class MainDemoModule Inherits ModuleBase Public Sub New() InitializeComponent() ApplicationModelManager.RaiseExceptionOnRequiredProperty = False; End Sub '...
          Comments (1)
          KK KK
          Krzysztof Krzysztof 4 years ago

            Possible ways to handle these consequences are described below:
            (…)

            • clear model cache (delete file Model.Cache.xafml).

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.