Changeset 3007 for trunk/sources
- Timestamp:
- 03/12/10 09:45:45 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Core/Serializer.cs
r3005 r3007 10 10 using System.Reflection; 11 11 using System.IO; 12 using System.Diagnostics; 12 13 13 14 namespace HeuristicLab.Persistence.Core { … … 140 141 } 141 142 143 private Stack<string> objectGraphTrace = new Stack<string>(); 144 142 145 private IEnumerator<ISerializationToken> Serialize(DataMemberAccessor accessor) { 146 143 147 object value = accessor.Get(); 144 148 if (value == null) … … 159 163 } 160 164 try { 165 objectGraphTrace.Push(accessor.Name); 161 166 IPrimitiveSerializer primitiveSerializer = configuration.GetPrimitiveSerializer(type); 162 167 if (primitiveSerializer != null) … … 182 187 return new List<ISerializationToken>().GetEnumerator(); 183 188 } else { 184 throw x; 185 } 189 throw; 190 } 191 } finally { 192 objectGraphTrace.Pop(); 186 193 } 187 194 } … … 191 198 sb.Append("Could not determine how to serialize a value of type \"") 192 199 .Append(type.VersionInvariantName()) 193 .AppendLine("\""); 194 sb.AppendLine("No registered primitive serializer for this type:"); 200 .AppendLine("\"") 201 .Append("object graph location: ") 202 .AppendLine(string.Join(".", objectGraphTrace.ToArray())) 203 .AppendLine("No registered primitive serializer for this type:"); 195 204 foreach (var ps in configuration.PrimitiveSerializers) 196 205 sb.Append(ps.SourceType.VersionInvariantName()) … … 205 214 .Append(cs.GetType().VersionInvariantName()) 206 215 .AppendLine(")"); 207 return new PersistenceException(sb.ToString()); 216 return new PersistenceException(sb.ToString()); 208 217 } 209 218
Note: See TracChangeset
for help on using the changeset viewer.