The backend of our project was .Net standard, the frontend was .Net Framework 4.7.2, we migrated our C# project to .Net 6.
We used the DevExpress toolkit on UI components. After the migration, while the WinForm designers are working fine, I am getting an error in the report designer.
The error says System.Runtime.Serialization.Primitives Version 6.0.0.0 not found. When I looked at the nuget packages, I saw that it existed until version 4.3.0. Shouldn't the SDK provide this package? I'm so confused.
Stack Info:
1. Hide Call Stack
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.ComponentModel.TypeDescriptor.CheckDefaultProvider(Type type)
at System.ComponentModel.TypeDescriptor.NodeFor(Type type, Boolean createDelegator)
at System.ComponentModel.TypeDescriptor.GetDescriptor(Type type, String typeName)
at System.ComponentModel.TypeDescriptor.GetProperties(Type componentType, Attribute[] attributes)
at DevExpress.Data.Browsing.DataBrowserHelperBase.GetListItemPropertiesByType(Type type, PropertyDescriptor[] listAccessors, Int32 startIndex)
at DevExpress.Data.Browsing.DataBrowserHelperBase.GetListItemProperties(Object list, PropertyDescriptor[] listAccessors)
at DevExpress.Data.Browsing.DataBrowserHelper.GetListItemProperties(Object list, PropertyDescriptor[] listAccessors)
at DevExpress.XtraReports.Native.Data.CustomRelatedListBrowser.GetItemProperties()
at DevExpress.Data.Browsing.Design.PropertiesProvider.ToFakedProperties(Object dataSource, String dataMember, PropertyDescriptor[] properties)
at DevExpress.Data.Browsing.Design.PropertiesProvider.ProcessProperties(PropertyDescriptorCollection properties, Object dataSource, String dataMember)
at DevExpress.Data.Browsing.Design.PropertiesProvider.GetItemProperties(Object dataSource, String dataMember, EventHandler`1 action)
at DevExpress.XtraReports.Design.DisplayNameProviderPickManager.GetDataSourceName(Object dataSource, String dataMember, IPropertiesProvider provider, EventHandler`1 callback)
at DevExpress.Data.Browsing.Design.PickManagerBase.<>c__DisplayClass4_0.b__0(IEnumerator enumerator)
at DevExpress.Data.Browsing.Design.ActionExecutor.RunAction()
at DevExpress.Data.Browsing.Design.ActionExecutor.AddAction(Action`1 action)
at DevExpress.Data.Browsing.Design.PickManagerBase.FillContent(IList nodes, Collection`1 dataSources, Boolean addNoneNode)
at DevExpress.XtraReports.Native.TreeListPickManager.FillContent(IList nodes, Collection`1 dataSources, Boolean addNoneNode)
at DevExpress.XtraReports.Native.DataSourceNativeTreeList.UpdateDataSource(IServiceProvider serviceProvider, Object[] dataSources)
at DevExpress.XtraReports.Design.FieldListTreeView.UpdateDataSource(IServiceProvider serviceProvider)
at DevExpress.XtraReports.Design.FieldListController.<>c__DisplayClass28_0.b__0()
at DevExpress.XtraReports.Design.FieldListController.ProcessMessage(Action action)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.ComponentModel.Design.DesignerHost.OnLoadComplete(EventArgs e)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.Serialization.IDesignerLoaderHost.EndLoad(String rootClassName, Boolean successful, ICollection errorCollection)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.OnEndLoad(Boolean successful, ICollection errors)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.OnEndLoad(Boolean successful, ICollection errors)
at DevExpress.XtraReports.Design.NetCore.CRCodeDesignerLoader.OnEndLoad(Boolean successful, ICollection errors)
at System.ComponentModel.Design.DesignerHost.BeginLoad(DesignerLoader loader)
I reinstalled Dotnet Runtimes, reinstalled DevExpress tool, reinstalled RepxPackage manually, installed Runtime.Primitives 4.3.0. None have been a solution.
Edit: I added new report to same project and same folder and that works, report designer opened. How should i fix old reports to new.
I copied report c# file and designer to new working report. Thats appeared.
Thank you for your answers in advance.
I wanted to prepare a guideline for those who encounter the same error.
First update your databinding sources to object data binding.
If error still exist follow the line:
This error occurs as a result of the report designer (DevExpress tool) not working or the breaking change after v16.1.
This error goes away when you call the following code block in the constructor with any executing mode in the report.
ScriptPermissionManager.GlobalInstance = new ScriptPermissionManager(ExecutionMode.Deny);
This applies to reports that are old and have outdated bindings. I replaced them with new expression bindings.
Thanks.