0

All I know about #pragma checksum is this:

The compiler uses a checksum for a file and inserts it in a .pdb file, so the debugger can compare the file it is debugging to the source file. With #pragma checksum we can define a customized checksum for a source file.

When should we use a customized checksum? and when is #pragma checksum actually useful?

What is changed when we use a #pragma checksum? Does it provide a better debugging experience?

Minimus Heximus
  • 2,683
  • 3
  • 25
  • 50
  • 1
    [The documentation is quite clear](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-pragma-checksum) - _"The Visual Studio debugger uses a checksum to make sure that it always finds the right source … This solution does not work for ASP.NET projects, because the computed checksum is for the generated source file, rather than the .aspx file. To address this problem, **#pragma checksum provides checksum support for ASP.NET pages**"_ – stuartd Nov 11 '19 at 11:05
  • @stuartd so isn't it useful for other projects? – Minimus Heximus Nov 11 '19 at 11:09
  • It isn't necessary for other projects because _"The compiler computes the checksum for a source file, and then emits the output to the program database (PDB) file. The debugger then uses the PDB to compare against the checksum that it computes for the source file."_ – stuartd Nov 11 '19 at 11:10
  • @stuartd but the example in that page seems to be a simple console app! – Minimus Heximus Nov 11 '19 at 11:15
  • So? It's an example of how to write one, not an entire web site. – stuartd Nov 11 '19 at 11:54

0 Answers0