.NET exception caught is unexpectedly null

后端 未结 6 1655
囚心锁ツ
囚心锁ツ 2021-02-05 01:16

See below for an explanation of what is going on

I have a really weird issue where the exception caught is null.

The code uses MEF and tries har

6条回答
  •  感情败类
    2021-02-05 01:53

    The exception is in fact not null, it's a problem with the debugger. Code contracts (ccrewrite) changes IL opcodes and that perturbates the debugger, because leave.s opcodes are transformed into leave opcodes. The two opcodes have different sizes and instruction adresses change, that's why the debugger is lost when exception names are the same.

    You can use $exception in the debugger to workaround the issue.

提交回复
热议问题