Eitan H.S.
Eitan H.S.

Reputation: 430

Exception thrown inside an empty catch block

I have the following weird error; An exception thrown on the empty Catch block!

Any ideas how this is possible and how to fix it?

Thanks!

blah

Upvotes: 0

Views: 196

Answers (2)

Eitan H.S.
Eitan H.S.

Reputation: 430

Ok, i think i got it...

For Each mediaPlayerID In _attachedDevices.Values.GroupBy(Function(t)t.MediaPlayerInfo.ID).Distinct()
    Try
        fileSystemPerMediaPlayerId.Add(mediaPlayerID.Key, New FileSystemOnDevice())
    Catch
    End Try
Next

The problem is caused by a null variable in the lambda expression inside the GroupBy method...
The compiler just pointed the wrong line..

Upvotes: 1

Chris Clower
Chris Clower

Reputation: 5104

It tried and failed, but there was nothing in the catch to handle it, hence the error NullReferenceException was unhandled.

Upvotes: 2

Related Questions