Changeset 6569 for branches/QAPAlgorithms/HeuristicLab.Persistence/3.3/Core
- Timestamp:
- 07/17/11 22:51:11 (14 years ago)
- Location:
- branches/QAPAlgorithms
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/QAPAlgorithms
- Property svn:ignore
-
old new 12 12 *.psess 13 13 *.vsp 14 *.docstates
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/QAPAlgorithms/HeuristicLab.Persistence
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Persistence merged: 6356,6446,6548
- Property svn:mergeinfo changed
-
branches/QAPAlgorithms/HeuristicLab.Persistence/3.3/Core/ConfigurationService.cs
r5445 r6569 42 42 43 43 private static ConfigurationService instance; 44 private static object locker = new object(); 44 45 private readonly Dictionary<IFormat, Configuration> customConfigurations; 45 46 … … 65 66 public static ConfigurationService Instance { 66 67 get { 67 if (instance == null) 68 instance = new ConfigurationService(); 69 return instance; 68 lock (locker) { 69 if (instance == null) 70 instance = new ConfigurationService(); 71 return instance; 72 } 70 73 } 71 74 } -
branches/QAPAlgorithms/HeuristicLab.Persistence/3.3/Core/Serializer.cs
r5445 r6569 246 246 compositeSerializer.CreateMetaInfo(value), 247 247 emitTypeInfo); 248 throw CreatePersistenceException(type, "Could not determine how to serialize a value." );248 throw CreatePersistenceException(type, "Could not determine how to serialize a value.", true); 249 249 } 250 250 catch (Exception x) { … … 255 255 throw; 256 256 } else { 257 throw CreatePersistenceException(type, "Uncaught exception during serialization: " + x.Message); 257 throw CreatePersistenceException( 258 type, 259 string.Format("Uncaught exception during serialization:{0}{1}", Environment.NewLine, x), 260 false); 258 261 } 259 262 } … … 261 264 objectGraphTrace.Pop(); 262 265 } 263 } 264 265 private PersistenceException CreatePersistenceException(Type type, string message ) {266 } 267 268 private PersistenceException CreatePersistenceException(Type type, string message, bool appendConfig) { 266 269 StringBuilder sb = new StringBuilder(); 267 270 sb.Append(message) … … 270 273 .AppendLine("\"") 271 274 .Append("object graph location: ") 272 .AppendLine(string.Join(".", objectGraphTrace.ToArray())) 273 .AppendLine("No registered primitive serializer for this type:"); 274 foreach (var ps in configuration.PrimitiveSerializers) 275 sb.Append(ps.SourceType.VersionInvariantName()) 276 .Append(" ---- (") 277 .Append(ps.GetType().VersionInvariantName()) 278 .AppendLine(")"); 279 sb.AppendLine("Rejected by all composite serializers:"); 280 foreach (var cs in configuration.CompositeSerializers) 281 sb.Append("\"") 282 .Append(cs.JustifyRejection(type)) 283 .Append("\" ---- (") 284 .Append(cs.GetType().VersionInvariantName()) 285 .AppendLine(")"); 275 .AppendLine(string.Join(".", objectGraphTrace.ToArray())); 276 if (appendConfig) { 277 sb.AppendLine("No registered primitive serializer for this type:"); 278 foreach (var ps in configuration.PrimitiveSerializers) 279 sb.Append(ps.SourceType.VersionInvariantName()) 280 .Append(" ---- (") 281 .Append(ps.GetType().VersionInvariantName()) 282 .AppendLine(")"); 283 sb.AppendLine("Rejected by all composite serializers:"); 284 foreach (var cs in configuration.CompositeSerializers) 285 sb.Append("\"") 286 .Append(cs.JustifyRejection(type)) 287 .Append("\" ---- (") 288 .Append(cs.GetType().VersionInvariantName()) 289 .AppendLine(")"); 290 } 286 291 return new PersistenceException(sb.ToString()); 287 292 }
Note: See TracChangeset
for help on using the changeset viewer.