[mono/monodevelop] 8d748598: Fixed 'Bug 15178 - Error while trying to deserialize

Mike Krüger ([email protected]) <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141837ba38b-465f74c2-e70c-46bb-b09f-98ad039dfb16-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/da4b32b427ef...8d748598f814

   Commit: 8d748598f81479ae2e9efa4a5e47f6f9bc9d5013
   Author: Mike Krüger <[email protected]> (mkrueger)
     Date: 2013-10-04 12:39:00 GMT
      URL: https://github.com/mono/monodevelop/commit/8d748598f81479ae2e9efa4a5e47f6f9bc9d5013

Fixed 'Bug 15178 - Error while trying to deserialize
ICSharpCode.NRefactory.TypeSystem.IProjectContent'.

Changed paths:
  M main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs

Modified: main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
===================================================================
@@ -1280,11 +1280,17 @@ static IProjectContent LoadProjectCache (Project project)
 					var cacheFile = Path.Combine (cacheDir, "completion.cache");
 					if (!File.Exists (cacheFile))
 						return null;
-					var cache = DeserializeObject<IProjectContent> (cacheFile);
-					var monoDevelopProjectContent = cache as MonoDevelopProjectContent;
-					if (monoDevelopProjectContent != null)
-						monoDevelopProjectContent.Project = project;
-					return cache;
+					try {
+						var cache = DeserializeObject<IProjectContent> (cacheFile);
+						var monoDevelopProjectContent = cache as MonoDevelopProjectContent;
+						if (monoDevelopProjectContent != null)
+							monoDevelopProjectContent.Project = project;
+						return cache;
+					} catch (Exception e) {
+						LoggingService.LogWarning ("Error while reading completion cache, regenerating", e); 
+						Directory.Delete (cacheDir, true);
+						return null;
+					}
 				}
 
 				#region IAssemblyReference implementation
_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.