- Timestamp:
- 09/14/11 13:59:25 (13 years ago)
- Location:
- branches/PersistenceSpeedUp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp
- Property svn:ignore
-
old new 12 12 *.psess 13 13 *.vsp 14 *.docstates
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/PersistenceSpeedUp/HeuristicLab.Persistence
- Property svn:mergeinfo changed
-
branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Core/Serializer.cs
r6737 r6760 210 210 } 211 211 ICompositeSerializer compositeSerializer = configuration.GetCompositeSerializer(type); 212 typeCache.SetSerializer(typeId, compositeSerializer.GetType());213 if (compositeSerializer != null)212 if (compositeSerializer != null) { 213 typeCache.SetSerializer(typeId, compositeSerializer.GetType()); 214 214 return CompositeEnumerator( 215 215 name, … … 218 218 typeId, 219 219 compositeSerializer.CreateMetaInfo(value)); 220 throw CreatePersistenceException(type, "Could not determine how to serialize a value.", null); 221 } catch (Exception x) { 220 } 221 throw CreatePersistenceException(type, "Could not determine how to serialize a value.", true); 222 } 223 catch (Exception x) { 222 224 if (isTestRun) { 223 225 exceptions.Add(x); … … 226 228 throw; 227 229 } else { 228 throw CreatePersistenceException(type, "Uncaught exception during serialization: ", x); 230 throw CreatePersistenceException( 231 type, 232 string.Format("Uncaught exception during serialization:{0}{1}", Environment.NewLine, x), 233 false); 229 234 } 230 235 } finally { … … 233 238 } 234 239 235 private PersistenceException CreatePersistenceException(Type type, string message, Exception x) {240 private PersistenceException CreatePersistenceException(Type type, string message, bool appendConfig) { 236 241 StringBuilder sb = new StringBuilder(); 237 242 sb.Append(message) … … 240 245 .AppendLine("\"") 241 246 .Append("object graph location: ") 242 .AppendLine(string.Join(".", objectGraphTrace.ToArray())) 243 .AppendLine("No registered primitive serializer for this type:"); 244 foreach (var ps in configuration.PrimitiveSerializers) 245 sb.Append(ps.SourceType.VersionInvariantName()) 246 .Append(" ---- (") 247 .Append(ps.GetType().VersionInvariantName()) 248 .AppendLine(")"); 249 sb.AppendLine("Rejected by all composite serializers:"); 250 foreach (var cs in configuration.CompositeSerializers) 251 sb.Append("\"") 252 .Append(cs.JustifyRejection(type)) 253 .Append("\" ---- (") 254 .Append(cs.GetType().VersionInvariantName()) 255 .AppendLine(")"); 247 .AppendLine(string.Join(".", objectGraphTrace.ToArray())); 248 if (appendConfig) { 249 sb.AppendLine("No registered primitive serializer for this type:"); 250 foreach (var ps in configuration.PrimitiveSerializers) 251 sb.Append(ps.SourceType.VersionInvariantName()) 252 .Append(" ---- (") 253 .Append(ps.GetType().VersionInvariantName()) 254 .AppendLine(")"); 255 sb.AppendLine("Rejected by all composite serializers:"); 256 foreach (var cs in configuration.CompositeSerializers) 257 sb.Append("\"") 258 .Append(cs.JustifyRejection(type)) 259 .Append("\" ---- (") 260 .Append(cs.GetType().VersionInvariantName()) 261 .AppendLine(")"); 262 } 256 263 return new PersistenceException(sb.ToString()); 257 264 }
Note: See TracChangeset
for help on using the changeset viewer.