Why "enable 32-bit applications" flag breaks line numbers in stack trace

Aleksei Poliakov

I have ASP .Net Web Application in C# (no MVC or WebForms) compiled in Release mode for AnyCPU, pdb files are enabled and deployed with application.

When enable 32-bit applications on AppPool has the default value of False the stack trace of the exception has correct line numbers.

When the flag is set to True the stack trace has incorrect line numbers.

Just to make it clear the only thing I change is the value for enable 32-bit applications flag in AppPool configuration of my web application.

I have tried this on two machines:

  1. Windows 8 with IIS 8.5.9600.16384
  2. Windows Server 2008 R2 with IIS 7.5.7600.16385

In my particular case it is OK to just reconfigure AppPool (we have already migrated from x86 to AnyCPU and this obsolete configuration is just a mistake), but I am still interested why does this happen? (may be there is some bug in IIS, I was not able to find this behavior mentioned anywhere).

Update: it seems I have figured it out, but this is a temporary reprieve:

  1. The problems is almost certainly due to code optimization (I have written code in such a way, that rules out other options: jitter reorders functions. This is not a compiler because I do not recompile application between tests).
  2. Most of the optimization is done by jitter, and x86 optimizations are more aggressive than x64 optimizations, thus the difference in resulting code. When Microsoft decides to make x64 optimizations more agressive lines will be broken.
Aleksei Poliakov

So the answer seems to be:

  1. There are basically two steps of optimization in C#: a compilter (csc.exe, when C# code is translated into IL) and a jitter (when IL is translated in machine code). Jitter does not most of the optimizations (article). Also there is a great post by Eric Lippert about which optimization you might expect.

  2. x86 and x64 jitters do different optimizations (CLR via C# Fourth Edition by Jeffrey Richter, Part V Threading, section Volatile Constructs, page 764)

Thus you can get correct line numbers in x64 (because jitter does not optimize code that aggressively) and x86 (that is more mature).

Summary: I have not found a way to work around it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Wrong line numbers in stack trace

From Dev

Get full stack trace with line numbers

From Dev

Rethrow an Exception with correct line numbers in the stack trace

From Dev

Getting line numbers from a stack trace in a JVM crash log

From Dev

Mysterious line in stack trace

From Dev

Add line numbers to stack trace of ASP.NET web site that is deployed in release mode

From Dev

Why is the exception stack trace not logged in?

From Dev

What do the + numbers mean in a stack trace

From Dev

What do the + numbers mean in a stack trace

From Dev

PHP-FPM breaks up stack trace log into separate events

From Dev

Print Stack Trace intefering with Print Line

From Dev

Show Full Stack Trace on PHP Command Line

From Dev

regex to parse first line of stack trace

From Dev

Error Object is null stack trace not show the line

From Dev

Why is my stack trace missing steps?

From Dev

Why is my stack trace being truncated?

From Dev

Line numbers in exception stack on winRT

From Dev

How to remove line breaks from large numbers?

From Dev

Why are Windows line breaks larger than Unix line breaks?

From Dev

NUnit/Mono not printing stack trace line number even with --debug

From Dev

Get complete stack trace for one-line fatal php error

From Dev

Get Line Highlighting (or at Least a Stack Trace) for noSuchMethod Exception Dart

From Dev

Get complete stack trace for one-line fatal php error

From Dev

java stack trace's line number mismatch with hadoop lib

From Dev

Why aren't there line breaks in this <pre> tag?

From Dev

Why is it faster to read a file without line breaks?

From Dev

Why does the paste command add line breaks?

From Dev

Why do Excel line breaks not transfer into Notepad?

From Dev

Why are there backslash `\` line breaks on this apt install command?

Related Related

  1. 1

    Wrong line numbers in stack trace

  2. 2

    Get full stack trace with line numbers

  3. 3

    Rethrow an Exception with correct line numbers in the stack trace

  4. 4

    Getting line numbers from a stack trace in a JVM crash log

  5. 5

    Mysterious line in stack trace

  6. 6

    Add line numbers to stack trace of ASP.NET web site that is deployed in release mode

  7. 7

    Why is the exception stack trace not logged in?

  8. 8

    What do the + numbers mean in a stack trace

  9. 9

    What do the + numbers mean in a stack trace

  10. 10

    PHP-FPM breaks up stack trace log into separate events

  11. 11

    Print Stack Trace intefering with Print Line

  12. 12

    Show Full Stack Trace on PHP Command Line

  13. 13

    regex to parse first line of stack trace

  14. 14

    Error Object is null stack trace not show the line

  15. 15

    Why is my stack trace missing steps?

  16. 16

    Why is my stack trace being truncated?

  17. 17

    Line numbers in exception stack on winRT

  18. 18

    How to remove line breaks from large numbers?

  19. 19

    Why are Windows line breaks larger than Unix line breaks?

  20. 20

    NUnit/Mono not printing stack trace line number even with --debug

  21. 21

    Get complete stack trace for one-line fatal php error

  22. 22

    Get Line Highlighting (or at Least a Stack Trace) for noSuchMethod Exception Dart

  23. 23

    Get complete stack trace for one-line fatal php error

  24. 24

    java stack trace's line number mismatch with hadoop lib

  25. 25

    Why aren't there line breaks in this <pre> tag?

  26. 26

    Why is it faster to read a file without line breaks?

  27. 27

    Why does the paste command add line breaks?

  28. 28

    Why do Excel line breaks not transfer into Notepad?

  29. 29

    Why are there backslash `\` line breaks on this apt install command?

HotTag

Archive