Can't Reassign Delegate from Immediate Window

Viewed 21

Context:

My c# program has a delegate like Func<bool> func = () => true; If I place a breakpoint directly after that line, run to that breakpoint, and work in the "Immediate Window"

func()
true

func = () => false
{Method = {Boolean <<>m0>b__0_0()}}
    Method: {Boolean <<>m0>b__0_0()}
    Target: {<>x.<>c}

func()
true // expected false

This behavior doesn't change if I assign existing functions instead of using lambda expressions.

Question:

  • Why can't the Immediate Window re-assign delegates while debugging?
  • Is this a documented feature, or a bug?
0 Answers
Related