4
votes

My problem is as follows: I added a reference to the assembly "System.Windows.Interactivity" to my WPF-project (.NET 4, VS2010) to implement a behavior. The whole solution builds and runs. The desired functionality that was implemented as behavior works fine.

But as soon as I open a XAML file (only XAML-code is shown, designer is not displayed) I get two exceptions in the error window:

1st Exception: "System.IO.FileLoadException was thrown on "SomeFile.xaml": Could not load file or assembly 'System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)."

2nd Exception: "Could not load file or assembly 'System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"

The exceptions arise even if I open a XAML file that does not contain the new behavior. Despite those exceptions, the solution builds and runs. If I close the XAML file, the exceptions disappear.

A similar issue is described in http://connect.microsoft.com/VisualStudio/feedback/details/648819/visual-studio-2010-silverlight-designer-crash. But this is for SL4.

How can I remove these exceptions? What is wrong here?

Thanks, Florian

2
This might be a bug in Visual Studio 2010, similar to the one you referenced. Have you reported this to Microsoft?Bernard
I did not report ths to Mircrosoft. But I wanted to do so. Before submitting this issue this morning I started Visual Studio. And surprisingly the exception were not there any more. I have absolutely no idea what happened. Only thing that changed are 5 Security updates that were installed today. I don't know if this solved my issue. Maybe anyone can confirm this behavior?Florian

2 Answers

3
votes

I know this is a pretty old post, but I spent a few hours struggling with this exact same error tonight. What was driving me crazy was that this same solution worked for me just fine about 6 months ago, then I handed it off to my client and they checked it in to VSS. They gave me back a (slightly modified) codebase that they zipped up, and this really manifested itself by the fact that Intellisense quit working inside the XAML file.

What finally did the trick for me was something I've never run into before. I navigated to the physical file location of System.Windows.Interactivity.dll, and under the General tab at the bottom in the "Security" section was this little nugget:

"This file came from another computer and might be blocked to help protect this computer."

Right next to this message was an "Unblock" button. I clicked this button, reloaded my project, and the error immediately went away and Intellisense immediately started working within my XAML file.

1
votes

Had the same problem. After a date, it stopped working. When I checked the system.windows.interactivity.dll with the file properties, I found the open with as NUnit. Then I remembered I had installed NUnit recently. I just changed the openwith with VS selector ( also set as always) and re-started the VS. Hurray.. Exception gone....

Not sure how openwith affects the VS IDE. but got it working again... back to track :D