Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/01/11 17:48:53 (13 years ago)
Author:
mkommend
Message:

#1479: Integrated trunk changes.

Location:
branches/GP.Grammar.Editor/HeuristicLab.Persistence/3.3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/GP.Grammar.Editor/HeuristicLab.Persistence/3.3/Core/Serializer.cs

    r5445 r6618  
    246246            compositeSerializer.CreateMetaInfo(value),
    247247            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);
    249249      }
    250250      catch (Exception x) {
     
    255255          throw;
    256256        } 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);
    258261        }
    259262      }
     
    261264        objectGraphTrace.Pop();
    262265      }
    263     }
    264 
    265     private PersistenceException CreatePersistenceException(Type type, string message) {
     266    }   
     267
     268    private PersistenceException CreatePersistenceException(Type type, string message, bool appendConfig) {
    266269      StringBuilder sb = new StringBuilder();
    267270      sb.Append(message)
     
    270273        .AppendLine("\"")
    271274        .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      }
    286291      return new PersistenceException(sb.ToString());
    287292    }
  • branches/GP.Grammar.Editor/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/System.Drawing/Bitmap2XmlSerializer.cs

    r5445 r6618  
    2828  internal sealed class Bitmap2XmlSerializer : PrimitiveXmlSerializerBase<Bitmap> {
    2929
    30     public override XmlString Format(Bitmap o) {
     30    public override XmlString Format(Bitmap o) {     
    3131      MemoryStream stream = new MemoryStream();
    32       o.Save(stream, ImageFormat.Png);
     32      lock (o)
     33        o.Save(stream, ImageFormat.Png);
    3334      byte[] array = stream.ToArray();
    3435      Byte1DArray2XmlSerializer serializer = new Byte1DArray2XmlSerializer();
  • branches/GP.Grammar.Editor/HeuristicLab.Persistence/3.3/HeuristicLabPersistencePlugin.cs.frame

    r6099 r6618  
    2727  /// The plugin for HeuriticLab.Persistence
    2828  /// </summary>
    29   [Plugin("HeuristicLab.Persistence", "3.3.4.$WCREV$")]
     29  [Plugin("HeuristicLab.Persistence", "3.3.5.$WCREV$")]
    3030  [PluginFile("HeuristicLab.Persistence-3.3.dll", PluginFileType.Assembly)]
    3131  [PluginDependency("HeuristicLab.Tracing", "3.3")]
  • branches/GP.Grammar.Editor/HeuristicLab.Persistence/3.3/Properties/AssemblyInfo.frame

    r6099 r6618  
    5252//
    5353[assembly: AssemblyVersion("3.3.0.0")]
    54 [assembly: AssemblyFileVersion("3.3.4.$WCREV$")]
     54[assembly: AssemblyFileVersion("3.3.5.$WCREV$")]
  • branches/GP.Grammar.Editor/HeuristicLab.Persistence/3.3/Tests/Properties/AssemblyInfo.cs

    r5446 r6618  
    5353// by using the '*' as shown below:
    5454[assembly: AssemblyVersion("3.3.0.0")]
    55 [assembly: AssemblyFileVersion("3.3.3.0")]
     55[assembly: AssemblyFileVersion("3.3.5.0")]
  • branches/GP.Grammar.Editor/HeuristicLab.Persistence/3.3/Tests/UseCases.cs

    r6377 r6618  
    12891289    }
    12901290
     1291    [TestMethod]
     1292    public void ConcurrentBitmapTest() {
     1293      Bitmap b = new Bitmap(300, 300);
     1294      Random r = new Random();
     1295      for (int x = 0; x<b.Height; x++) {
     1296        for (int y = 0; y<b.Width; y++) {
     1297          b.SetPixel(x, y, Color.FromArgb(r.Next()));
     1298        }
     1299      }
     1300      Task[] tasks = new Task[20];
     1301      byte[][] datas = new byte[tasks.Length][];
     1302      for (int i = 0; i<tasks.Length; i++) {
     1303        tasks[i] = Task.Factory.StartNew((idx) => {
     1304          using (var stream = new MemoryStream()) {
     1305            XmlGenerator.Serialize(b, stream);
     1306            datas[(int)idx] = stream.ToArray();
     1307          }
     1308        }, i);
     1309      }
     1310      Task.WaitAll(tasks);
     1311    }
     1312
    12911313    [ClassInitialize]
    12921314    public static void Initialize(TestContext testContext) {
Note: See TracChangeset for help on using the changeset viewer.