Comments
2 comments
-
Hi.
I don't think that the generated code is faulty. Both pieces of code return the result of ConnectionString, and both pieces of code only take the lock if the compare result is >= 0. The difference is simply that Reflector isn't generating a body that has an embedded return statement. -
Additionally, if you have the optimizer turned on while compiling (on by default) then it may change your code to that that was disassembled.
Add comment
Please sign in to leave a comment.
Disassemble of the following class: Gives the following disassemble faulty code:
Notice how the DateTime.Compare test is disassembled!!
If I remove the lock statement the disassembled code is correct so seems to be connected to Montor.Enter/Exit statements in IL code.
Jonny Bekkum, Norway