Browse Source

Throws a XamlLoadException with an error message describing the error instead of a NullReferenceException in the case where the document failed to load.

pull/53/merge
Tobias Gummesson 12 years ago committed by Siegfried Pammer
parent
commit
83026098fa
  1. 9
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlDesignContext.cs

9
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlDesignContext.cs

@ -89,6 +89,15 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml @@ -89,6 +89,15 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml
loadSettings.ReportErrors(xamlErrorService);
if (_doc == null) {
string message;
if (xamlErrorService != null && xamlErrorService.Errors.Count > 0)
message = xamlErrorService.Errors[0].Message;
else
message = "Could not load document.";
throw new XamlLoadException(message);
}
_rootItem = _componentService.RegisterXamlComponentRecursive(_doc.RootElement);
if(_rootItem!=null){

Loading…
Cancel
Save