Bug 1277 - diffing on a plist file causes an exception dialog to show
Summary: diffing on a plist file causes an exception dialog to show
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Version Control ()
Version: 2.8 Alpha 2
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Alan McGovern
Depends on:
Reported: 2011-10-05 18:02 UTC by Miguel de Icaza [MSFT]
Modified: 2011-10-12 11:35 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Miguel de Icaza [MSFT] 2011-10-05 18:02:37 UTC
Reported on Twitter by @hiive:

@Xamarin_com diffing on a plist file causes an exception dialog to show (right-click in solution explorer, version control->diff).
Comment 1 Alan McGovern 2011-10-06 11:09:00 UTC
The current exception is caused because plist files are opened with a special viewer by default and this special viewer does not support a Diff view being placed on top of it.

The full solution to this is something as follows:

We need a set of handlers for diffing files. This will be implemented as an extension point to allow something like this:

public void ShowDiffView (FilePath file)
    foreach (var v in GetExtensionPoints ('/whatever/diffviewhandler'))
        if (v.CanHandle (file))
            Use (v);

This will allow us to implement different techniques for diffing different files. For example .plist files can be either binary or xml. We can load and edit both in the plist editor but currently it's only possible to diff the xml ones with the current code. With this approach we could trivially handle binary and text plist files. We can also implement a diff for image files, or any other format we require.

This is the approach I'm going to take to fix the issue.
Comment 2 Miguel de Icaza [MSFT] 2011-10-06 11:15:02 UTC
Could we provide a fallback for items that do not have a special visualizer to show a text view with the diff output?
Comment 3 Mikayla Hutchinson [MSFT] 2011-10-06 11:20:15 UTC
Miguel, the problem is that the current Diff view only supports attaching when the main view is a SourceEditor. I assume that's because it tracks the caret position. If we guarded that functionality with an "if (mainView is SourcEditor) ..." we could make it function as a fallback diff view for any main view, but only when the file is also detected to be text.
Comment 6 Alan McGovern 2011-10-12 11:35:13 UTC
this is supported in git now. We only display a read-only interface when viewing a plist diff. If the user wants to modify the plist file they must do it via the normal plist editor (either in simple more or advanced mode). It would be too simple for a typo to be made in the diff editor which would make it impossible to serialize the change to/from the plist file on disk.