Author: ankit
Date: 2007-08-21 15:56:22 -0400 (Tue, 21 Aug 2007)
New Revision: 84583
Modified:
trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog
trunk/monodevelop/Extras/prj2make-sharp-lib/CsprojInfo.cs
trunk/monodevelop/Extras/prj2make-sharp-lib/MsPrjHelper.cs
trunk/monodevelop/Extras/prj2make-sharp-lib/PrjHelper.cs
Log:
Fix bug #82517.
* CsprojInfo.cs (LoadPrjFromFile): Use the 'using' pattern for FileStream.
(.ctor): Rethrow exception.
* MsPrjHelper.cs (ParseSolution): Add 'monitor' param. Use monitor for
reporting errors. We stop trying to load the solution if any of the projects
fail to load.
(MsSlnHelper): Add 'monitor' param.
* PrjHelper.cs (MakerMain): Track changes in api.
Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog 2007-08-21
19:21:36 UTC (rev 84582)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog 2007-08-21
19:56:22 UTC (rev 84583)
@@ -1,3 +1,14 @@
+2007-08-22 Ankit Jain <[EMAIL PROTECTED]>
+
+ Fix bug #82517.
+ * CsprojInfo.cs (LoadPrjFromFile): Use the 'using' pattern for
FileStream.
+ (.ctor): Rethrow exception.
+ * MsPrjHelper.cs (ParseSolution): Add 'monitor' param. Use monitor for
+ reporting errors. We stop trying to load the solution if any of the
projects
+ fail to load.
+ (MsSlnHelper): Add 'monitor' param.
+ * PrjHelper.cs (MakerMain): Track changes in api.
+
2007-08-21 Andrés G. Aragoneses <[EMAIL PROTECTED]>
Improve fix for bug #82398.
Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/CsprojInfo.cs
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/CsprojInfo.cs 2007-08-21
19:21:36 UTC (rev 84582)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/CsprojInfo.cs 2007-08-21
19:56:22 UTC (rev 84583)
@@ -38,14 +38,13 @@
// Project desirialization
protected
MonoDevelop.Prj2Make.Schema.Csproj.VisualStudioProject LoadPrjFromFile (string
strIn)
{
- FileStream fs = new FileStream (strIn, FileMode.Open);
+ using (FileStream fs = new FileStream (strIn,
FileMode.Open)) {
- XmlSerializer xmlSer = new XmlSerializer
(typeof(MonoDevelop.Prj2Make.Schema.Csproj.VisualStudioProject));
- MonoDevelop.Prj2Make.Schema.Csproj.VisualStudioProject
prjObj = (MonoDevelop.Prj2Make.Schema.Csproj.VisualStudioProject)
xmlSer.Deserialize (fs);
-
- fs.Close();
-
- return (prjObj);
+ XmlSerializer xmlSer = new XmlSerializer
(typeof(MonoDevelop.Prj2Make.Schema.Csproj.VisualStudioProject));
+
MonoDevelop.Prj2Make.Schema.Csproj.VisualStudioProject prjObj =
(MonoDevelop.Prj2Make.Schema.Csproj.VisualStudioProject) xmlSer.Deserialize
(fs);
+ fs.Close();
+ return (prjObj);
+ }
}
public CsprojInfo(bool isUnixMode, bool isMcsMode, string name,
string guid, string csprojpath)
@@ -72,9 +71,9 @@
Console.WriteLine (
String.Format ("Could not load the file
{0}\nException: {1}",
csprojpath,
- exc.Message)
+ exc.ToString ())
);
- return;
+ throw;
}
// Establish if the allow unsafe code flag is true
Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/MsPrjHelper.cs
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/MsPrjHelper.cs 2007-08-21
19:21:36 UTC (rev 84582)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/MsPrjHelper.cs 2007-08-21
19:56:22 UTC (rev 84583)
@@ -134,7 +134,7 @@
projGuidInfo[projectGuid] = pi;
}
- protected void ParseSolution(string fname)
+ protected void ParseSolution(string fname, IProgressMonitor
monitor)
{
FileStream fis = new FileStream(fname,FileMode.Open,
FileAccess.Read, FileShare.Read);
using (StreamReader reader = new StreamReader(fis)) {
@@ -150,14 +150,19 @@
string csprojPath =
match.Groups[3].Value;
string projectGuid =
match.Groups[4].Value;
- if (csprojPath.EndsWith
(".csproj") && !csprojPath.StartsWith("http://"))
- {
- csprojPath = MapPath
(Path.GetDirectoryName (fname), csprojPath);
-
- CsprojInfo pi = new
CsprojInfo (m_bIsUnix, m_bIsMcs, projectName, projectGuid, csprojPath);
-
-
projNameInfo[projectName] = pi;
-
projGuidInfo[projectGuid] = pi;
+ try {
+ if (csprojPath.EndsWith
(".csproj") && !csprojPath.StartsWith("http://"))
+ {
+ csprojPath =
MapPath (Path.GetDirectoryName (fname), csprojPath);
+ CsprojInfo pi =
new CsprojInfo (m_bIsUnix, m_bIsMcs, projectName, projectGuid, csprojPath);
+
projNameInfo[projectName] = pi;
+
projGuidInfo[projectGuid] = pi;
+ }
+ } catch (Exception ex) {
+ Console.WriteLine
(GettextCatalog.GetString ("Could not import project:") + csprojPath);
+ Console.WriteLine
(ex.ToString ());
+ monitor.ReportError
(GettextCatalog.GetString ("Could not import project:") + csprojPath, ex);
+ throw;
}
}
@@ -169,7 +174,7 @@
}
}
- public string MsSlnHelper(bool isUnixMode, bool isMcsMode, bool
isSln, string slnFile)
+ public string MsSlnHelper(bool isUnixMode, bool isMcsMode, bool
isSln, string slnFile, IProgressMonitor monitor)
{
bool noCommonTargets = false;
bool noProjectTargets = false;
@@ -207,7 +212,7 @@
// We invoke the ParseSolution
// by passing the file obtained
- ParseSolution (slnFile);
+ ParseSolution (slnFile, monitor);
}
else
{
@@ -530,7 +535,7 @@
{
// We invoke the ParseSolution
// by passing the file obtained
- ParseSolution (slnFileName);
+ ParseSolution (slnFileName, monitor);
// Create all of the prjx files form the csproj
files
monitor.BeginTask (null,
projNameInfo.Values.Count * 2);
Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/PrjHelper.cs
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/PrjHelper.cs 2007-08-21
19:21:36 UTC (rev 84582)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/PrjHelper.cs 2007-08-21
19:56:22 UTC (rev 84583)
@@ -9,6 +9,7 @@
using MonoDevelop.Prj2Make.Schema.Prjx;
using MonoDevelop.Prj2Make.Schema.Csproj;
using MonoDevelop.Core;
+using MonoDevelop.Core.ProgressMonitoring;
namespace MonoDevelop.Prj2Make
{
@@ -68,16 +69,17 @@
{
SlnMaker mk1Obj = null;
CmbxMaker mk2Obj = null;
+ IProgressMonitor monitor = new NullProgressMonitor ();
// Test to see what kind if file we got
// sln, csproj, cmbx, prjx
switch(DetermineFileType(slnFile))
{
case TypeOfFile.sln:
mk1Obj = new SlnMaker();
- return mk1Obj.MsSlnHelper (isUnixMode, isMcsMode, true,
slnFile);
+ return mk1Obj.MsSlnHelper (isUnixMode, isMcsMode, true,
slnFile, monitor);
case TypeOfFile.csproj:
mk1Obj = new SlnMaker();
- return mk1Obj.MsSlnHelper (isUnixMode, isMcsMode, false,
slnFile);
+ return mk1Obj.MsSlnHelper (isUnixMode, isMcsMode, false,
slnFile, monitor);
case TypeOfFile.cmbx:
mk2Obj = new CmbxMaker();
return mk2Obj.MdCmbxHelper (isUnixMode, isMcsMode, true,
slnFile);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches