0

I've encountered a NullReferenceException that is not handled by the MVC global error event handler (Application_Error). This is only happening in production. The IIS application pool shuts down after five failures due to the Rapid-Fail Protection IIS settings. There's only one application in the pool.

Below is a snippet from a .wer (Windows Error Reporting) file. It contains information about the unhandled exception. My understanding is Sig[6] contains the important value. I used the value e3 (227 in decimal) to find the method signature in IL code.

EXE File name:                  Sig[0].Value=w3wp.exe 
EXE File Assembly Version:      Sig[1].Value=7.5.7601.17514 
EXE File Stamp:                 Sig[2].Value=4ce7afa2 
EXE File Full Assembly Version: Sig[3].Value=System.Web 
Faulting Assembly Version:      Sig[4].Value=4.7.3282.0 
Faulting Assembly Timestamp:    Sig[5].Value=5bd8e3e7 
Faulting Assembly Method Def:   Sig[6].Value=e3
Faulting Method IL Offset:      Sig[7].Value=25
Exception Type:                 Sig[8].Value=System.NullReferenceException

The value of Sig[6] translates to the token 06000227. The instructions for translating from e3 to 06000227 can be found here.

.method /*06000227*/ private hidebysig newslot specialname virtual final 
        instance bool  System.Web.HttpApplication.IExecutionStep.get_IsCancellable() cil managed
{
  .override System.Web.HttpApplication/*0200003A*//IExecutionStep/*0200003F*/::get_IsCancellable /*0200003F::0600020B*/ 
  // Code size       2 (0x2)
  .maxstack  8
  IL_0000:  ldc.i4.0
  IL_0001:  ret
} // end of method MapHandlerExecutionStep::System.Web.HttpApplication.IExecutionStep.get_IsCancellable

Provided I did the translation correctly, why would IsCancellable throw/cause a NullReferenceException? Is there more for me to trace up the call stack? The fact that the error is coming from System.Web is confusing me.

Other event handlers used in the global.asax:

  • Application_PreRequestHandlerExecute
  • Application_BeginRequest
  • Application_AuthenticateRequest

Please let me know if you need more details.

Thank you for your help.

  • Is this easily reproduced? Sounds like it may be. If so, why not attach a debugger? – Zer0 Feb 19 '19 at 21:37
  • @Zer0, thanks for your reply. It's only reproducible in production. Unfortunately, I cannot attach a debugger. – Tyler Frazier Feb 20 '19 at 11:57
  • 1
    Why did you convert the sig[6] value to decimal before adding the `06` prefix? I think the metadata token for the method you want is actually `060000e3`. – Brian Reichle Feb 20 '19 at 22:25
  • @BrianReichle, I can't recall why I did that. Probably out of confusion. Anyway, I believe you are correct. The token led me to method AssociateWithCurrentThread, which I think means I have async/await Task issues somewhere. Thank you for your help. – Tyler Frazier Feb 27 '19 at 14:13

0 Answers0