R# loses link between XAML and code-behind

I'm doing WPF development with VS2010RC and the up-to-date EAP builds (1641 at the moment).

I'm seeing a problem which occurs after some time (an hour or so), where R# somehow seems to lose the association between XAML files and their code-behind. This causes lots of errors - errors in the XAML where for example event handlers are shown as errors, and errors in the code-behind, where references to objects created by the XAML are seen as errors.

The project compiles and runs fine, but of course the 'go to next error' feature in R# becomes useless because of all the false positives.

It doesn't happen to all files at the same time, and I'm not sure what triggers it - I suspect it starts with an error in XAML which I'm working on, which causes some kind of upset in R# which doesn't get recovered from once the file is fixed.   There are no R# exceptions shown.   Unloading and reloading the solution (you don't need to restart VS) fixes the problem, although the errors remain cached, and you have to 'visit' each file with a false error in it for R# to realise it's OK.

I'm not sure of the best way to report this kind of bug, or what supporting info you need.   I tend to see this every hour or so of work, but that doesn't mean that it's going to be an easy repro for anyone else.

If anyone at JB wanted to do remote debug or needs a process dump, I can probably arrange that.

7 comments
Comment actions Permalink

Will, could you, please check does it happen that R# thinks classes in .xaml and .xaml.cs files belong to different namespaces. You may check that by invoking goto file and typing in the class name.

0
Comment actions Permalink

Will,

I'm seeing a problem which occurs after some time (an hour or so), where R# somehow seems to lose the association between XAML files and their code-behind.


I had this problem yesterday after adding an assembly reference.

--
/\/\arkus.

0
Comment actions Permalink

Sergey,

Yes, that's exactly what's happened - thanks for the tip.

I've done ctrl-T on the type of a UserControl-derived class, and the popup has offered me the following:

MyControl (in ProjectRootNamespace.Controls)
MyControl (in ProjectRootNamespace.ProjectRootNamespace.Controls)

Clearly the first one is correct, and the second one is not.  If I choose each of them from the popup, the first one takes me to the code-behind and the second one takes me to the XAML.

Does that help you fix it, or does it suggest a quicker workaround for me than unloading the solution and reloading it?

Thanks,

Will

0
Comment actions Permalink

This is excatly the behaviour I observed once. Thanks for pointing out, will fix ASAP.

0
Comment actions Permalink

Excellent - thanks - will it be in the next nightly?

0
Comment actions Permalink

I've fixed it yesterday, so the today's nightly must contain the fix.

0

Please sign in to leave a comment.