Browse Source

Fixed crash when adding new/existing projects to an existing solution.

newNRvisualizers
Daniel Grunwald 13 years ago
parent
commit
35394eb1af
  1. 4
      src/Main/Base/Project/Src/Project/AbstractProject.cs
  2. 11
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

4
src/Main/Base/Project/Src/Project/AbstractProject.cs

@ -186,6 +186,8 @@ namespace ICSharpCode.SharpDevelop.Project
get { return activeConfiguration; } get { return activeConfiguration; }
set { set {
WorkbenchSingleton.AssertMainThread(); WorkbenchSingleton.AssertMainThread();
if (value == null)
throw new ArgumentNullException();
if (activeConfiguration != value) { if (activeConfiguration != value) {
activeConfiguration = value; activeConfiguration = value;
@ -210,6 +212,8 @@ namespace ICSharpCode.SharpDevelop.Project
get { return activePlatform; } get { return activePlatform; }
set { set {
WorkbenchSingleton.AssertMainThread(); WorkbenchSingleton.AssertMainThread();
if (value == null)
throw new ArgumentNullException();
if (activePlatform != value) { if (activePlatform != value) {
activePlatform = value; activePlatform = value;

11
src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

@ -402,10 +402,7 @@ namespace ICSharpCode.SharpDevelop.Project
Dictionary<string, string> globalProps = new Dictionary<string, string>(); Dictionary<string, string> globalProps = new Dictionary<string, string>();
InitializeMSBuildProjectProperties(globalProps); InitializeMSBuildProjectProperties(globalProps);
globalProps["Configuration"] = configuration; globalProps["Configuration"] = configuration;
globalProps["Platform"] = platform;
//HACK: the ActivePlatform property should be set properly before entering here, but sometimes it does not
if (platform != null)
globalProps["Platform"] = platform;
MSBuild.Project project = MSBuildInternals.LoadProject(projectCollection, projectFile, globalProps); MSBuild.Project project = MSBuildInternals.LoadProject(projectCollection, projectFile, globalProps);
if (openCurrentConfiguration) if (openCurrentConfiguration)
currentlyOpenProject = project; currentlyOpenProject = project;
@ -1246,8 +1243,10 @@ namespace ICSharpCode.SharpDevelop.Project
{ {
this.projectCollection = loadInformation.ParentSolution.MSBuildProjectCollection; this.projectCollection = loadInformation.ParentSolution.MSBuildProjectCollection;
this.FileName = loadInformation.FileName; this.FileName = loadInformation.FileName;
this.ActiveConfiguration = loadInformation.Configuration; if (loadInformation.Configuration != null)
this.ActivePlatform = loadInformation.Platform; this.ActiveConfiguration = loadInformation.Configuration;
if (loadInformation.Platform != null)
this.ActivePlatform = loadInformation.Platform;
projectFile = ProjectRootElement.Open(loadInformation.FileName, projectCollection); projectFile = ProjectRootElement.Open(loadInformation.FileName, projectCollection);
if (loadInformation.upgradeToolsVersion == true && CanUpgradeToolsVersion()) { if (loadInformation.upgradeToolsVersion == true && CanUpgradeToolsVersion()) {

Loading…
Cancel
Save