October 31, 2019

"Custom plug-ins should not catch exceptions"... that's new.

The title refers to an error message I got today in one of my plugins, the complete text is the following:

ISV code reduced the open transaction count. Custom plug-ins should not catch exceptions from OrganizationService calls and continue processing.

I googled the message and I found the explanation inside the following page: Troubleshoot plug-ins.
The reason is simple: inside my code I wrapped an IOrganizationService.Update inside a try catch block:
try
{
    Entity updateRecord = new Entity(recordRef.LogicalName, recordRef.Id);
    updateRecord[fieldName] = fieldValue;
    service.Update(updateRecord);
}
catch (Exception ex) {
    // ...
}
Why I did that? In my case the specific update may or may not fail (due to the status of the entity and the field that I need to update) but I needed to make sure the plugin containing the above code should never fail.
I don't have a specific workaround to resolve this situation because it really depends on the logic you have inside the plugin (in my case one of the options is to create an additional async plugin just to perform this update so it will not affect the main plugin).
The page mentions that this error has been added recently, so if in your existing plugins you have an IOrganizationService call wrapped inside a try catch block, the plugin is probably failing right now.

UPDATE: looks like that wrapping an IOrganizationService call was never possible, but the platform before returned a non meaningful error message (like "no active transaction found"), at least now we are notified with the exact reason. Thanks Tanguy Touzard and Jonas Rapp for the correction!

October 18, 2019

PCF Gallery - 5 months after

Today (18 October 2019) I added the 100th to PCF Gallery.

All the controls listed inside PCF Gallery can be downloaded, and the source code is available inside their GitHub repository or in the blog post linked inside the page. The majority of the controls is for Model-driven apps, some of them can be added also to Canvas apps and there are also a couple created specifically just for Canvas apps.

There is no doubt the PowerApps Component Framework is one of the most interesting capabilities landed recently inside the Power Platform world, at least for developers!

When I wrote the post announcing the launch of PCF Gallery, I optimistically wished that soon it would list dozen of controls. After few months, thanks to the contributions from more than 40 authors, PCF Gallery is a beautiful showcase of the possibilities offered by the PowerApps Component Framework.

A big thanks to the whole PCF Community!