== How to fix it in NUnit Remove the `ExpectedException` attribute in favor of using the https://docs.nunit.org/articles/nunit/writing-tests/assertions/classic-assertions/Assert.Throws.html[Assert.Throws] assertion. === Code examples ==== Noncompliant code example [source,vbnet,diff-id=2,diff-type=noncompliant] ---- ' Noncompliant Public Sub Method_NullParam() Dim sut As New MyService() sut.Method(Nothing) End Sub ---- ==== Compliant solution [source,vbnet,diff-id=2,diff-type=compliant] ---- Public Sub Method_NullParam() Dim sut As New MyService() Assert.Throws(Of ArgumentNullException)(Sub() sut.Method(Nothing)) End Sub ----