Search This Blog

Saturday, June 9, 2018

WinForms v18.1.3 - Beware of the NullReferenceException in property grids on mouse scroll

In XAF, users of the Model Editor and Report Designer tools are likely to be affected by this issue. Well, advanced users who enabled the ShowPropertyGrid property in the layout control or made custom PropertyGridControl integrations may be affected too - at least we all know a few😉

Our XtraVerticalGrid developers are aware of this problem and have already fixed it in v18.1.4 (it should be out in 1.5-2 weeks). In the meantime, the hotfix is already available for download at T638535: PropertyGridControl - The NullReferenceException is thrown when scrolling and an editor is active. Please accept sincerely apologies from our XAF, XtraReports and XtraVerticalGrid teams for all the inconvenience here.

Here is the error callstack for your reference:

System.NullReferenceException at DevExpress.XtraVerticalGrid.PGEditingState.MouseWheel(DevExpress.Utils.MouseWheelScrollClientArgs) at DevExpress.XtraVerticalGrid.BaseHandler.DevExpress.Utils.IMouseWheelScrollClient.OnMouseWheel(DevExpress.Utils.MouseWheelScrollClientArgs) at DevExpress.Utils.MouseWheelScrollHelper.OnScrollLine(DevExpress.Utils.DXMouseEventArgs, Int32, Boolean) at DevExpress.Utils.MouseWheelScrollHelper.OnMouseWheel(System.Windows.Forms.MouseEventArgs) at DevExpress.XtraVerticalGrid.BaseHandler.OnMouseWheel(System.Windows.Forms.MouseEventArgs) at DevExpress.XtraVerticalGrid.VGridControlBase.OnMouseWheelCore(System.Windows.Forms.MouseEventArgs) at DevExpress.XtraEditors.Container.EditorContainer.OnMouseWheel(System.Windows.Forms.MouseEventArgs) at System.Windows.Forms.Control.WmMouseWheel(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef) at DevExpress.XtraEditors.Container.EditorContainer.WndProc(System.Windows.Forms.Message ByRef) at DevExpress.XtraVerticalGrid.VGridControlBase.WndProc(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)


Tip 1: The How to obtain a design-time exception call stack KB article describes how to locate these important error details, especially if your Visual Studio crashed. This information is helpful when submitting to support. BTW, to improve your chances of getting a faster and helpful answer from support, check these related tips as well:
   How do I ask a good question? (StackOverFlow)
   How to Report Bugs Effectively (Simon Tatham)
   A request for simple example programs (Julian Bucknall)
   Collect and Analyze the Diagnostic Information (XAF documentation)


Tip 2: When you located the call stack information and determined from it that an exception is raised from DevExpress code, I recommend you search for one or several topmost call stack method names in our support database. This behavior might be reported by someone else, e.g.: https://www.google.com/search?q=PGEditingState.MouseWheel


FreeImages.com

Friday, June 1, 2018

Concurrent Record Updates Merging in XPO-based XAF ASP.NET apps (v18.1)

From the Optimistic Concurrency Control help topic:
"In multi-user data-aware applications, there are times when one user edits a record while another user is editing the same record. As long as the changes being made do not affect the same field (e.g., one user modifies the task description while another user attaches a file), XAF applications can resolve the situation, and merge simultaneous changes made by different users. To enable field-level locking, set the XpoDefault.TrackPropertiesModifications static property to true."

Previously, this feature was available only for WinForms apps. With v18.1, ASP.NET WebForms XAF applications can handle concurrent record updates by merging simultaneous changes (by two or more different users) as well:


Here is also a video from our MainDemo.Web app (run from the Demo Center):



Notice that two different users can edit different properties (e.g., NickName and SpouseName) and then merge  these non-conflicting changes.

Have you already enabled this feature in your XAF Web apps? Please let us know how this works for you.

How to access and manipulate a custom ASP.NET user control from a Controller in a Module project


We have updated our How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET) tutorial with more information on how to pass external data to custom Web user controls

Previously, our customers had the following difficulties with this task:

- In which project to create web user controls. By default, ASP.NET suggests doing this in the YourSolution.Web project. Adding an *.ASCX control into the YourSolutionName.Module.Web project led to errors.

- How to deal with circular references when attempting to reference the YourSolution.Web project from a Controller defined in the YourSolutionName.Module.Web project.
- How to pass an IObjectSpace, XafApplication or current View object to a custom user control.


A common way to resolve such a dependency (unrelated to XAF itself) is to define an interface within your class library (a XAF module project) and implement it by using your custom user control.


Thursday, May 31, 2018

WinForms - How to manage long text in DocumentManager tabs

Please check out the Problem and Solutions sections in the T629226: WinForms - Long text is cut off in DocumentManager tabs ticket.

We are going to improve this in the upcoming v18.1+. Our designer's favorite is #2, but we cannot implement it in a minor version due to a breaking change. BTW, option #1 shown in the screenshot below also looks fine. Take note of solution #3 as well - you can customize this behavior without writing any code.


Please let me know what option you prefer or if you are handling it differently. Thanks.

BTW, have you modernized your XAF WinForms apps using SVG icons and Light Style in v18.1? Click the screenshot below to see the new look & feel. Do you like it?


Friday, May 25, 2018

Web - How to avoid issues with data-bound controls due to missing or non-unique key values

Check out the Web - How to avoid issues with data-bound controls due to missing or non-unique key values KB article to make sure that your business model is aligned with the best practices. Here is a short extract:


Symptoms
You may notice the following side-effects in a Web ListView while it may work fine in WinForms:
- A wrong DetailView may be selected when an unsaved record is clicked in ListView;
- ListView may have no selection column;
- In inline edit or batch mode, all records may become selected or editable.
These effects are especially frequent in a non-persistent class ListView or a nested ListView for an aggregated details collection with newly added or unsaved records.

Explanation
All new records added to the ListView and not yet saved to the database will be assigned with a temporary key value (e.g. -1 or an empty Guid/String value depending on your key type). In a Web application, ListView uses a business class key property to identify records, because there is no way to access real business objects from the web browser. Hence, there is a requirement that each business object must have a unique value assigned to the key property. ASPxGridView and other data-bound controls require this for the correct operation of such features like selection, filtering, sorting, grouping and the standard XAF functionality that depends on them (see also ASPxGridBase > KeyFieldName). 
If a key property is missing in a business class completely or if a key property is not initialized with a unique value immediately after the record is created, these duplicate or invalid records may lead to a data-bound control malfunction as expected.


Please inform me of your health-check results!

FreeImages.Com

Friday, May 11, 2018

Improved diagnostics for ListView errors in Server Mode

From the Core - ListView shows blank rows or freezes in certain scenarios in Server Mode ticket:


In certain scenarios, a list view with DataAccessMode set to Server may show empty rows or operate slowly. This behavior is usually caused by exceptions thrown during data loading that are handled internally. Such situations can be diagnosed using the debugger (see What to do when the grid displays blank rows in Server Mode and ASPxGridView displays empty rows when bound via Server Mode).

Starting with v18.1, we improved the XAF built-in diagnostics for errors occurring in Server Mode data sources. Now, server-side errors (intercepted via the ServerExceptionThrown event) are written to the application log. In addition, when the log level is set to 4 (Verbose), errors reported via the InconsistencyDetected event are also written to the log. While the latter event doesn't always indicate a problem, the error message may be helpful in researching the cause of performance issues.



Wednesday, May 9, 2018

Quick questions on our change log

Q1: How often do you check the "Resolved Issues", "Known Issues", "Breaking Changes" pages in our What's New documentation? For instance: "never, did not know about this page"; "every minor"; "every major"; "rarely, only when I encounter an issue"; "once 1-2 year when we upgrade"; your option.
Q2: What would you like to improve about these pages to make your work more comfortable?
Q3: Are you missing anything important from the "New Major Features" section like this for v18.1?



This post idea came after looking at the fixed XAF issues for the upcoming v17.2.8:

As you can see, titles have different formatting and it is not easy to find all issues for a certain platform or module, e.g. Mobile.

This is how a bit better formatted list looks now:

This needs a little bit more discipline from our team, but may be more helpful for our customers. I am  still hesitating because this problem may not exist for many, because Google Analytics reports low visits for these pages.

I hope you can help us see whether to focus on more important things by answering my questions above. Your other thoughts and suggestions are welcome too, as always.

See Also: General Information > Installation > Upgrade Notes