V
Versteijn
Hello all,
I have a custom Exception inherited class with the following
constructor. I added the IIf call because the Parameters() value might
be null. But somehow I keep getting an ArgumentNullException on
String.Format: 'Value cannot be null. Parameter name: args'.
If I replace this FalsePart of IIf with a random string like "hello
world", nothing is wrong, the correct part (TruePart) is used and I
get no exception.
It looks like the String.Format is executed anyway, also when the IIf
returns TruePart.
Any clues?
Regards,
Freek Versteijn
Public Sub New(ByVal ExceptionID As Integer, ByVal Parameters() As
Object, ByVal Message As String, ByVal InnerException As Exception)
MyBase.New(IIf(Parameters Is Nothing, Message,
String.Format(Message, Parameters)) & " (ExceptionID=" & ExceptionID &
")", InnerException)
FExceptionID = ExceptionID
FParameters = New Collection
End Sub
I have a custom Exception inherited class with the following
constructor. I added the IIf call because the Parameters() value might
be null. But somehow I keep getting an ArgumentNullException on
String.Format: 'Value cannot be null. Parameter name: args'.
If I replace this FalsePart of IIf with a random string like "hello
world", nothing is wrong, the correct part (TruePart) is used and I
get no exception.
It looks like the String.Format is executed anyway, also when the IIf
returns TruePart.
Any clues?
Regards,
Freek Versteijn
Public Sub New(ByVal ExceptionID As Integer, ByVal Parameters() As
Object, ByVal Message As String, ByVal InnerException As Exception)
MyBase.New(IIf(Parameters Is Nothing, Message,
String.Format(Message, Parameters)) & " (ExceptionID=" & ExceptionID &
")", InnerException)
FExceptionID = ExceptionID
FParameters = New Collection
End Sub