I have a bug that has been recurring with some frequency during the RC cycle of VS 2010 and its still there in the RTM.Lets say I have a SL usercontrol with several fields on it. All of a sudden the usercontrol gets in a state where the code behind cannot see the fields in the XAML. If you try and specify the fields in code, intellisense does not work and typing the field name generates an error.

And if you run the app and look at the instance of the control, sometimes there are no custom fields on the instance. Sometimes there are.

The only solution has been to

  1. Copy the control xaml and code behind files
  2. Delete the xaml and code behind files.
  3. Check in (if using TFS)
  4. Create a new control with the same name and then copy the stuff back into it from the files you copied out.

Not very elegant but it seems to work.

Latest posts by Ken Spencer (see all)