简体   繁体   中英

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!

等等

它尝试并失败了,但是捕获中没有任何东西可以处理,因此NullReferenceException was unhandled错误NullReferenceException was unhandled

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..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM