locked
Could not load file or assembly 'Microsoft.VisualStudio.DebuggerVisualizers

    Question

  • In my Windows 8 Store app I have a basic page based on Prism. In the page's code behind there is the following method

    protected override void OnNavigatedTo(NavigationEventArgs e)
            {
                base.OnNavigatedTo(e);
                var viewModel = this.DataContext as INotifyPropertyChanged;
                if (viewModel != null)
                {
                    viewModel.PropertyChanged += ViewModel_PropertyChanged;
                }
            }

    Where the PropertyChanged event gets subscribed an error occurs that reads

    Could not load file or assembly 'Microsoft.VisualStudio.DebuggerVisualizers, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

    How does this error arise, and how can I fix it. I know of no modules in my application that rely on DebuggerVisualizers.

    Sunday, November 02, 2014 4:19 AM

Answers

  • This problem turned out to be related to missing or corrupted files from a Git repository that got overwritten. If this problem happens again, I would delete the bin and debug folders and the [UI Project].csproj.user file. Then recompile the whole solution.
    • Marked as answer by IMOsiris Wednesday, November 05, 2014 4:55 PM
    Wednesday, November 05, 2014 4:55 PM

All replies

  • You are probably referencing an assembly (maybe a third-party one?) that has a dependency upon Microsoft.VisualStudio.DebuggerVisualizers.dll. Remove this reference or add a reference to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.VisualStudio.DebuggerVisualizers.dll.
    Sunday, November 02, 2014 12:39 PM
  • I added the reference but still get the following error:

    An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

    Additional information: Could not load file or assembly 'Microsoft.VisualStudio.DebuggerVisualizers, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

    More importantly, because I cannot subscribe to the viewModel PropertyChanged event, the zoom out feature of the Semantic Zoom control does not display anything when I zoom out. My hack--and I hate doing this-- is to change the method to

    protected override void OnNavigatedTo(NavigationEventArgs e)
            {
                base.OnNavigatedTo(e);
                var viewModel = this.DataContext as INotifyPropertyChanged;
                if (viewModel != null)
                {
                    viewModel.PropertyChanged += ViewModel_PropertyChanged;
                    (SemanticZoom.ZoomedOutView as ListViewBase).ItemsSource =       GroupedItemsViewSource.View.CollectionGroups;
                }

            }

    As shown, rather than setting the data source for the Semantic Zoom control zoomed out component when the PropertyChanged event occurs, I have to explicitly set the data source in the OnNavigatedTo method. In other words, ViewModel_PropertyChanged does not get invoked.


    • Edited by IMOsiris Sunday, November 02, 2014 8:33 PM Edits
    Sunday, November 02, 2014 8:29 PM
  • This problem turned out to be related to missing or corrupted files from a Git repository that got overwritten. If this problem happens again, I would delete the bin and debug folders and the [UI Project].csproj.user file. Then recompile the whole solution.
    • Marked as answer by IMOsiris Wednesday, November 05, 2014 4:55 PM
    Wednesday, November 05, 2014 4:55 PM