Free Succinctly book series from Syncfusion

Lately Syncfusion started producing e-books grouped under Succinctly series. The books are for developers on (mostly) Microsoft platform and are a free download albeit registration is required. I’ve peeked into few of them and I have to say I like them.

They won’t replace commercial n-hundred pages long developer books though but they provide you an introduction, the basics of the topic and serve as quick reference. So it is worth checking them out and kudos to Syncfusion.

An exotic DevEx’ ReportDesigner breaking change in 12.2

If you ever customized (excellent) DevExpress ReportDesigner you might have used this line of code to obtain a reference to IDataSourceCollectionProvider within ReportDesigner class which allows to access field list:

IDataSourceCollectionProvider dataSourceCollectionProvider = 
    designerHost.GetDesigner(designerHost.RootComponent) 
    as IDataSourceCollectionProvider;

This code worked well in 12.1 and perhaps in earlier 12.2 versions but it certainly won’t work in 12.2.5. The bad part is that it fails in runtime, while it still compiles perfectly. At least it fails consistently – always. The reason is that access to various services (IDataSourceCollectionProvider is one of them) is now through ReportDesigner.GetService(Type serviceType) method. Replacing the part above with the one below does the trick:

IDataSourceCollectionProvider dataSourceCollectionProvider = 
    (IDataSourceCollectionProvider)designerHost.GetService(
        typeof(IDataSourceCollectionProvider)
    );

The new is more readable and it could be even better if it used generics. I’d certainly consider this declaration instead:

T GetService<T>()
  where T: class
{
   ...
}

which would yield even more readable assignment:

IDataSourceCollectionProvider dataSourceCollectionProvider = 
    designerHost.GetService<IDataSourceCollectionProvider>();

There you have the fix.