1. When the Windows Forms Visual Inheritance is involved, we strongly recommend using the new XPBindingSource component (available starting with version 19.1) for data binding. Refer to our WinForms code example to get started.
The classic XPO data sources (XPCollection, XPView, XPDataView, XPCursor, XPPageSelector) and server mode data source components (XPServerCollectionSource, XPInstantFeedbackSource, LinqServerModeSource, EntityServerModeSource, etc.) can be added to the last descendant only. Due to the Visual Studio design-time specificities, these components can attempt to use the database connection at design-time when added to a base Form or UserControl. This can cause exceptions or unwanted side effects.
2. Starting with version 14.1.5, classic XPO data sources detect if the current Form or UserControl is not a last descendant and throw a meaningful warning. For backward compatibility, we left a possibility to disable this feature by setting the static DevExpress.Data.Helpers.IsDesignModeHelper.BypassDesignModeAlterationDetection property to true. Put the corresponding code before the InitializeComponent method call in the base Form or UserControl class.
C#using System.Windows.Forms;
namespace WindowsFormsApplication1 {
public partial class MyFormBase : Form {
public MyFormBase() {
DevExpress.Data.Helpers.IsDesignModeHelper.BypassDesignModeAlterationDetection = true;
InitializeComponent();
}
}
}
Visual BasicImports System.Windows.Forms
Namespace WindowsFormsApplication1
Partial Public Class MyFormBase
Inherits Form
Public Sub New()
DevExpress.Data.Helpers.IsDesignModeHelper.BypassDesignModeAlterationDetection = True
InitializeComponent()
End Sub
End Class
End Namespace
I just downloaded 14.1.4 to test this, but I could not find this property. I also searched your whole source code for 'BypassDesignModeAlterationDetection' and didn't find anything.
@Steffen: I apologize for the inconvenience here, as this option is available starting with version 14.1.5 only (you can wait for the official release in several weeks or download this hot fix ). I also wanted to remind that you should use that exercise this option at your own risk, and the preferred way is still to use the components on the last inherited control to avoid side effects.
We will report to DevExpress Team after testing this patch .But we wonder there is no problem before V13.2.29.
For some reason, this problem occurs when we have an XPDataView on the last inherited control, but it's Session is defined on the parent.
A web-safe Session is passed to the last inherited report constructor and assigned post-initialisation?
@Renier: This article also covers the XPDataView component and the suggestions above apply to your situation as well. If this does not help, please create a separate ticket and attach your problematic sample there for internal research.
I'm getting the same error on a form derived directly from DevExpress.XtraEditors.XtraForm and with a XPServerCollectionSource, an UnitOfWork and a GridControl defined on it. I tried to set BypassDesignModeAlterationDetection to true, but it doesn't seem to make any difference.
I'm using DevExpress.v15.2 on Visual Studio Pro 2015 update 1.
Hello Jose,
To process your recent post more efficiently, I created a separate ticket on your behalf: T344461. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.