TraceSeverity.None Throws Exception

TraceSeverity flags are leveraged to report varying levels of criticality to the ULS log.  By properly leveraging the TraceSeverity flag, a developer can provide critical information to the SharePoint Administrator to assist in diagnosing code or service-related issues.

As you can see, the TraceSeverity enumeration includes the flag of “None”.  If a developer attempts to use TraceSeverity.None, it will throw an exception, similar to this:

This appears to be by design.  In the SPDiagnosticServicesBase.WriteTrace method, we can see that Microsoft intended to throw this exception when using TraceSeverity.None:

In addition, using EventSeverity.None will throw a similar error.

Leave a Reply