The only thing I can think of is the race condition, but both the calling function and the line of code are synchronous with my knowledge.
The line propInfo.SetValue(obj, null) will be executed if I just stop before the loop and step by step (or just go to this line), however, if I do not use a breakpoint, it never sets property (s) to null . Why is this?
Specific Information :
- If I do not use a breakpoint, it does not work.
- If I put a breakpoint at the top of the foreach and press f5, it does not work.
- If I put a breakpoint at the top of the foreach and step by step through f10, it works.
- If I put a breakpoint on a line of code
propInfo.SetValue(obj, null); , she works. - The breakpoint after the loop still shows the values ββas non-zero.
- If I change
null to 5 (this is an invalid value), it throws an exception telling me that this is an invalid value.
To clarify, βDoesn't workβ means that it does not set the null property.
What I tried:
- Restarting Visual Studio (2013)
- Change a line of code (used for
default(T) ) - Project Properties β Assembly β Optimize Code (initially disabled)
EDIT
It has narrowed that the reason for this behavior is the properties of EF Navigation. The code works, but for some reason, the navigation properties refuse to become null. So, what about navigational properties causing this behavior?
c # entity-framework entity-framework-6
Shelby115
source share