Status | ID | Priority | Type |
Closed | 25272 | Blocker | Bug |
Profile | Reply |
HakanClient | Hello, When the Editors and Editors.Web modules are used in a web application, and if a CriteriaPropertyEditor (Xafari or XAF) is in a detailview, the following unhandled exception occurs (popup criteria editor or not): [NullReferenceException: Object reference not set to an instance of an object.] Xafari.Editors.Model.ModelListViewXafariEditorsLogic.Get_DataAccessMode(IModelListView listViewModel) +20ModelListView.GetStaticDataAccessModeCalculator(ModelNode node) +53 Version: 15.2.508.692 (Latest) Attached files: |
User | Description | Posted On |
Sasha (Xafari Support)Client | Hello Hakan, We are going to investigate it. Give us some time. Best regards, | |
Sasha (Xafari Support)Client | Hello Hakan, We apologize for the delayed response. Please, can you check availability Xafari and Xafari.Web modules in your project? Thanks, Sasha. | |
Hakan | Hello Sasha, Yes, Xafari and Xafari.Web modules are included in my project. They are both referenced and loaded as modules. | |
Sasha (Xafari Support)Client | Hi, We have replicated this behavior, but it specific situation. Best regards, | |
Hakan | Hello Sasha, You can find my class implementation below. The error is not only for this class, but for all Criteria Editors in the project. using System; public override void AfterConstruction() protected override void OnSaving() protected override void OnChanged(string propertyName, object oldValue, object newValue) [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("Description")] [DevExpress.Persistent.Base.ImmediatePostDataAttribute] [ModelDefault("AllowNew", "false"), ModelDefault("AllowEdit", "false"), ModelDefault("AllowDelete", "false")] [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("Criterion")] [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("Text")] [NonCloneable] [NonCloneable] [NonCloneable] [NonCloneable] [DevExpress.Xpo.AssociationAttribute("RL_Opportunity_Stage_Criteria", UseAssociationNameAsIntermediateTableName = true)] | |
Sasha (Xafari Support)Client | Hello Hakan, Thanks for the clarification. To fix this issue you can: - At first we reccomend you to use attribute [TypeConverter(typeof(FilteredLocalizedClassInfoTypeConverter<BaseObject>))] in place of [TypeConverter(typeof(LocalizedClassInfoTypeConverter))], where you can set other base type for filter instead BaseObject (): [ModelDefault("AllowNew", "false"), ModelDefault("AllowEdit", "false"), ModelDefault("AllowDelete", "false")] [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)] [DevExpress.Persistent.Base.VisibleInDetailViewAttribute(false)] [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("Module name")] [ValueConverter(typeof(TypeToStringConverter)), ImmediatePostData] [TypeConverter(typeof(LocalizedClassInfoTypeConverter))] [TypeConverter(typeof(FilteredLocalizedClassInfoTypeConverter<BaseObject>))] public Type ObjectType { get { return GetPropertyValue("ObjectType"); } set { SetPropertyValue("ObjectType", value); Criterion = String.Empty; } } - Next step you have to create a new interface (as example IModelListViewXafariEditorsFix) and inherit the interface from the interface IModelListViewXafariEditors: public interface IModelListViewXafariEditorsFix : IModelListViewXafariEditors { [Category("Behavior"), RefreshProperties(RefreshProperties.All)] new CollectionSourceDataAccessMode DataAccessMode { get; set; } } [DomainLogic(typeof(IModelListViewXafariEditorsFix))] public static class ModelListViewXafariEditorsLogic { public static CollectionSourceDataAccessMode Get_DataAccessMode(IModelListView listViewModel) { if (listViewModel.Application == null) return CollectionSourceDataAccessMode.Client; CollectionSourceDataAccessMode dataAccessMode = listViewModel.Application.Options.DataAccessMode; string str = (listViewModel.EditorType == null) ? "" : listViewModel.EditorType.FullName; if (((str == "") || (dataAccessMode == CollectionSourceDataAccessMode.Client)) || !str.Contains("Xafari")) { return dataAccessMode; } string[] source = new string[] { "Xafari.Editors.Win.XafariTreeListEditor", "Xafari.Editors.Win.WinHierarchyNodeListEditor", "Xafari.Editors.Win.WinExplorerListEditor", "Xafari.Editors.Web.ASPxCardListEditor", "Xafari.Editors.Web.ASPxHierarchyNodeListEditor", "Xafari.Editors.Web.ASPxXafariTreeListEditor", "Xafari.Editors.Web.ASPxExplorerListEditor" }; string[] strArray2 = new string[] { "Xafari.Editors.Win.XafariTreeListEditor", "Xafari.Editors.Win.WinHierarchyNodeListEditor", "Xafari.Editors.Web.ASPxHierarchyNodeListEditor", "Xafari.Editors.Web.ASPxXafariTreeListEditor" }; if (((dataAccessMode != CollectionSourceDataAccessMode.DataView) || !source.Contains(str)) && ((dataAccessMode != CollectionSourceDataAccessMode.Server) || !strArray2.Contains(str))) { return dataAccessMode; } return CollectionSourceDataAccessMode.Client; } } And you have to override the ExtendModelInterfaces() in Module.cs: public override void ExtendModelInterfaces(ModelInterfaceExtenders extenders) { base.ExtendModelInterfaces(extenders); extenders.Add<IModelListView, IModelListViewXafariEditorsFix>(); } We hope you find this information helpful. | |
Sasha (Xafari Support)Client | Hello Hakan, This issue resolved in last Xafari v15.2.708.747 partly. Feel free to contact us if you have any questions. | |
Sasha (Xafari Support)Client | Hello, Feel free to contact us if you need further assistance or have additional questions. |