Xamarin.Forms: Portable Class Library (PCL) and Code Coverage

.NET developers have used the [ExcludeFromCodeCoverage] attribute to focus validation on their business logic’s code coverage.

However, when building Xamarin.Forms applications, the [ExcludeFromCodeCoverage] attribute is not supported within the Portable Class Library.

To workaround this issue, use the [DebuggerNonUserCode] attribute instead. Be aware that the debugger will be disabled for the code associated to this attribute. As a result, to use the debugger, one must comment out or remove the “DebuggerNonUserCode” attribute.

NOTE:

Scott Nimrod is fascinated with Software Craftsmanship.

He loves responding to feedback and encourages people to share his articles.

He can be reached at scott.nimrod @ bizmonger.net

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: