Browse Source

Fixed SD2-1507 - ArgumentNullException when closing a form.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3742 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Christian Hornung 17 years ago
parent
commit
52c20abe83
  1. 25
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs

25
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs

@ -289,21 +289,30 @@ namespace ICSharpCode.FormsDesigner
protected void Reparse() protected void Reparse()
{ {
ParseInformation info;
ICompilationUnit cu;
// Reparse primary file to update currentClassPart // Reparse primary file to update currentClassPart
ParseInformation info = ParserService.ParseFile(this.ViewContent.PrimaryFileName, this.ViewContent.PrimaryFileContent, false); this.currentClassPart = null;
ICompilationUnit cu = info.BestCompilationUnit; if (!String.IsNullOrEmpty(this.ViewContent.PrimaryFileName)) {
foreach (IClass c in cu.Classes) { info = ParserService.ParseFile(this.ViewContent.PrimaryFileName, this.ViewContent.PrimaryFileContent, false);
if (FormsDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(c)) { cu = info.BestCompilationUnit;
if (FormsDesignerSecondaryDisplayBinding.GetInitializeComponents(c) != null) { foreach (IClass c in cu.Classes) {
this.currentClassPart = c; if (FormsDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(c)) {
break; if (FormsDesignerSecondaryDisplayBinding.GetInitializeComponents(c) != null) {
this.currentClassPart = c;
break;
}
} }
} }
} else {
LoggingService.Debug("AbstractDesignerGenerator.Reparse: Primary file is unavailable");
info = null;
} }
// Reparse designer code file to update initializeComponents, // Reparse designer code file to update initializeComponents,
// completeClass and formClass // completeClass and formClass
if (this.ViewContent.DesignerCodeFile != this.ViewContent.PrimaryFile) { if (info == null || this.ViewContent.DesignerCodeFile != this.ViewContent.PrimaryFile) {
// Actual parsing is only necessary if the designer code file // Actual parsing is only necessary if the designer code file
// is not the same as the primary file. Otherwise we just // is not the same as the primary file. Otherwise we just
// reuse the parse info from above. // reuse the parse info from above.

Loading…
Cancel
Save