GithubHelp home page GithubHelp logo

chrisbertranddotnet / universalserializer Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 3.0 836 KB

UniversalSerializer is a data serialization library for .NET/.NET Core/.NET Standard/UWP (Universal Windows)/Mono/Xamarin/Silverlight on Windows, Linux, macOS, Android and iOS.

C# 99.22% ASP 0.39% HTML 0.39%

universalserializer's People

Contributors

chrisbertranddotnet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

universalserializer's Issues

Error 20 when trying to serialize a type with a pointer.

I am trying to serialize an object that contains a pointer (SvnChangeItem from SharpSvn).

Exception message:
Error 20 : (internal) Can not create a TypeManager for type SharpSvn.SvnChangeItem.

Inner Exception message:
ArgumentException: The type 'svn_log_changed_path2_t*' may not be used as a type argument.

Example Code:

		void SerializeChangeItem(SvnChangeItem changeItem)
		{
			using (var s = new UniversalSerializerWinForm("serialized.uniser"))
			{
				s.Serialize(changeItem);
			}
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			using (SvnClient client = new SvnClient())
			{
				Collection<SvnLogEventArgs> x = new Collection<SvnLogEventArgs>();
				client.GetLog(@"C:\Users\aarthur\F0123",new SvnLogArgs
					{
						Range = new SvnRevisionRange(SvnRevision.Zero, SvnRevision.Head)
					},out x);

				foreach (SvnLogEventArgs xx in x)
				{
					if (xx.ChangedPaths == null)
						continue;

					foreach (SvnChangeItem xxx in xx.ChangedPaths)
					{
						SerializeChangeItem(xxx);
					}
				}
			}
		}

The Exception occurs on the following line:
Type typed = L2GenericTypeManagerTypeDefinition.MakeGenericType(new Type[] { type });

The exception occurs because type.IsPointer is true.

UWP compile from source - WS2019 and Windows 10 1903

If I try to compile the UWP solution from the downloaded ZIP file setting as target version 1903 on VS2019 it does not compile and reports several errors on JSON serializer.
I added the JSON variable to exclude from compilation but then I get 82 errors:

Severity Code Description Project File Line Suppression State Error CS1061 'Application' does not contain a definition for 'Windows' and no accessible extension method 'Windows' accepting a first argument of type 'Application' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1521 Active Error CS1061 'Application' does not contain a definition for 'Windows' and no accessible extension method 'Windows' accepting a first argument of type 'Application' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1524 Active Error CS1061 'Application' does not contain a definition for 'Windows' and no accessible extension method 'Windows' accepting a first argument of type 'Application' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1526 Active Error CS0122 'FrameworkElement.FrameworkElement()' is inaccessible due to its protection level Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 639 Active Error CS1061 'Tests.DerivedWindow' does not contain a definition for 'Close' and no accessible extension method 'Close' accepting a first argument of type 'Tests.DerivedWindow' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 827 Active Error CS0117 'Tests.DerivedWindow' does not contain a definition for 'Title' Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 823 Active Error CS1061 'Tests.DerivedWindow' does not contain a definition for 'Title' and no accessible extension method 'Title' accepting a first argument of type 'Tests.DerivedWindow' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 825 Active Error CS0509 'Tests.DerivedWindow': cannot derive from sealed type 'MainPage' Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 2815 Active Error CS1729 'UIElement' does not contain a constructor that takes 0 arguments Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 639 Active Error CS1729 'Window' does not contain a constructor that takes 0 arguments Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1344 Active Error CS0117 'Window' does not contain a definition for 'Cursor' Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1344 Active Error CS1061 'Window' does not contain a definition for 'Cursor' and no accessible extension method 'Cursor' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1296 Active Error CS1061 'Window' does not contain a definition for 'Cursor' and no accessible extension method 'Cursor' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1299 Active Error CS0117 'Window' does not contain a definition for 'FontFamily' Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1344 Active Error CS1061 'Window' does not contain a definition for 'FontFamily' and no accessible extension method 'FontFamily' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1230 Active Error CS1061 'Window' does not contain a definition for 'FontFamily' and no accessible extension method 'FontFamily' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1264 Active Error CS1061 'Window' does not contain a definition for 'FontFamily' and no accessible extension method 'FontFamily' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1344 Active Error CS0117 'Window' does not contain a definition for 'FontSize' Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1344 Active Error CS0117 'Window' does not contain a definition for 'Icon' Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1344 Active Error CS1061 'Window' does not contain a definition for 'Icon' and no accessible extension method 'Icon' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1250 Active Error CS1061 'Window' does not contain a definition for 'Icon' and no accessible extension method 'Icon' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1252 Active Error CS1061 'Window' does not contain a definition for 'Icon' and no accessible extension method 'Icon' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1285 Active Error CS1061 'Window' does not contain a definition for 'Icon' and no accessible extension method 'Icon' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1344 Active Error CS1061 'Window' does not contain a definition for 'Show' and no accessible extension method 'Show' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1377 Active Error CS1061 'Window' does not contain a definition for 'ShowDialog' and no accessible extension method 'ShowDialog' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1380 Active Error CS0117 'Window' does not contain a definition for 'Title' Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1344 Active Error CS1061 'Window' does not contain a definition for 'Title' and no accessible extension method 'Title' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 825 Active Error CS1061 'Window' does not contain a definition for 'Title' and no accessible extension method 'Title' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1335 Active Error CS1061 'Window' does not contain a definition for 'Title' and no accessible extension method 'Title' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1373 Active Error CS1061 'Window' does not contain a definition for 'WindowState' and no accessible extension method 'WindowState' accepting a first argument of type 'Window' could be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1376 Active Error CS1503 Argument 1: cannot convert from 'Test_UniversalSerializer.Tests.DerivedWindow' to 'Windows.UI.Xaml.Window' Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 824 Active Warning CS0184 The given expression is never of the provided ('Tests.DerivedWindow') type Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 825 Active Error CS0103 The name 'Brushes' does not exist in the current context Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1359 Active Error CS0103 The name 'Cursors' does not exist in the current context Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1344 Active Error CS0103 The name 'Orientation' does not exist in the current context Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1349 Active Error CS0103 The name 'WindowState' does not exist in the current context Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1376 Active Error CS0246 The type or namespace name 'Button' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1363 Active Error CS0246 The type or namespace name 'Button' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1363 Active Error CS0246 The type or namespace name 'Color' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1350 Active Error CS0234 The type or namespace name 'Controls' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 638 Active Error CS0246 The type or namespace name 'Cursor' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1300 Active Error CS0246 The type or namespace name 'FontFamily' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1230 Active Error CS0246 The type or namespace name 'FontFamily' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1234 Active Error CS0246 The type or namespace name 'FontFamily' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1268 Active Error CS0234 The type or namespace name 'Media' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1252 Active Error CS0234 The type or namespace name 'Media' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1253 Active Error CS0234 The type or namespace name 'Size' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 705 Active Error CS0234 The type or namespace name 'Size' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 706 Active Error CS0246 The type or namespace name 'SolidColorBrush' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1350 Active Error CS0246 The type or namespace name 'StackPanel' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1216 Active Error CS0246 The type or namespace name 'StackPanel' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1216 Active Error CS0246 The type or namespace name 'StackPanel' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1218 Active Error CS0246 The type or namespace name 'StackPanel' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1219 Active Error CS0246 The type or namespace name 'StackPanel' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1348 Active Error CS0246 The type or namespace name 'StackPanel' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1386 Active Error CS0246 The type or namespace name 'TextBlock' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1352 Active Error CS0246 The type or namespace name 'TextBlock' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1386 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 640 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 642 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 849 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 849 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 850 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 852 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1115 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1115 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1116 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1117 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1125 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1126 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1128 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1184 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1185 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1193 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1194 Active Error CS0246 The type or namespace name 'TextBox' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1217 Active Error CS0246 The type or namespace name 'TextDecoration' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1314 Active Error CS0246 The type or namespace name 'TextDecoration' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1316 Active Error CS0246 The type or namespace name 'TextDecorationCollection' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1313 Active Error CS0246 The type or namespace name 'TextDecorationCollection' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1315 Active Error CS0246 The type or namespace name 'UIElementCollection' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 637 Active Error CS0246 The type or namespace name 'UIElementCollection' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 641 Active Error CS0246 The type or namespace name 'UniversalSerializerWPF' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1522 Active Error CS0246 The type or namespace name 'UniversalSerializerWPF' could not be found (are you missing a using directive or an assembly reference?) Tester C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\Common tests\Tests.cs 1522 Active

Can you please help?

UWP application - add UWP Project to solution - a lot of errors

I have an UWP app. Due to the NUGET error on 64bit I tried to add the UWP project under my project and add the reference (only the project as I do not need the tests).

I get a lot of:
Severity Code Description Project File Line Suppression State
Error NU1201 Project UniversalSerializer 3 for UWP is not compatible with uap10.0.17763 (UAP,Version=v10.0.17763) / win10-arm. Project UniversalSerializer 3 for UWP supports: uap10.0.18362 (UAP,Version=v10.0.18362) SerializationTest C:\Users\massi\source\repos\SerializationTest\SerializationTest\SerializationTest.csproj 1

Even if I'm compiling for Debug - X64

Can you help please?

Some thing fail during deserializing, much appreciated if you could review and fix it or any advice.

Dear sir.ChrisBertrand,

First of all, I would like to thank you very much for your great 'n helpful UniversalSerializer.
But there is some thing fail during my Deserializing.
I have created small project under dotnet4.5/vs2017 and zip it for you to easily debugging.

The simple code is also placed here.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using UniversalSerializerLib3;

namespace Test.UniversalSerializer
{
public class Form1 : Form
{
private Tester tester = new Tester();

    public Form1()
    {
        tester.Test1(); // This method fail !
        tester.Test2(); // This method not fail.
    }
}

public class Tester
{
    private string fileName = "Test.xml";
    private TestClass test1 = new UniversalSerializer.TestClass();

    public void Test1()
    {
        test1.d1 = 1.234;
        SerializeMethod1(); // it produce good Test.xml file.
        test1.d1 = 2.2;
        SerializeMethod1(); // error occur here, also there has additional ">" character be stamped in lastest line of Test.xml file.
    }

    private void SerializeMethod1()
    {
        using (UniversalSerializerLib3.UniversalSerializer ser = new UniversalSerializerLib3.UniversalSerializer(fileName,
                UniversalSerializerLib3.SerializerFormatters.XmlSerializationFormatter))
        {
            ser.Serialize(test1);
            var result = ser.Deserialize<TestClass>();
        }
    }

    public void Test2()
    {
        test1.d1 = 1.234;
        SerializeMethod2(); // it produce good Test.xml file
        test1.d1 = 2.2;
        SerializeMethod2(); // this is not error, but also has additional ">" character be stamped in lastest line of Test.xml file.
    }

    private void SerializeMethod2()
    {
        using (UniversalSerializerLib3.UniversalSerializer ser = new UniversalSerializerLib3.UniversalSerializer(fileName,
                UniversalSerializerLib3.SerializerFormatters.XmlSerializationFormatter))
        {
            ser.Serialize(test1);
        }

        using (UniversalSerializerLib3.UniversalSerializer ser = new UniversalSerializerLib3.UniversalSerializer(fileName,
                UniversalSerializerLib3.SerializerFormatters.XmlSerializationFormatter))
        {
            var result = ser.Deserialize<TestClass>();
        }
    }
}

public class TestClass
{
    public double d1 { get; set; }
}

}
Test.UniversalSerializer.zip

System.ArgumentException: Stream was not readable (using CryptoStream)

I am using UniversalSerializer 3.18.3.14 and Unity 2019.1

  • Writing to a FileStream works, but writing to a CryptoStream throws an exception.

  • The exception only occurs when using the BinarySerializationFormatter.

  • Error does not happen when using XML or JSON serialization formatter.

This code works:

using (FileStream file = File.Create("/Users/Me/Desktop/File.txt"))
{
    var s = new UniversalSerializer(file);
    s.Serialize(myString);
}

This code also works: (CryptoStream, using XmlSerializationFormatter)

using (FileStream file = File.Create("/Users/Me/Desktop/File.txt"))
{
    using (CryptoStream csEncrypt = new CryptoStream (file, encryptor, CryptoStreamMode.Write))
    {
        var s = new UniversalSerializer(csEncrypt, SerializerFormatters.XmlSerializationFormatter);
        s.Serialize(myString);
    }
}

This code throws error: System.ArgumentException: Stream was not readable
(CryptoStream, using BinarySerializationFormatter)

using (FileStream file = File.Create("/Users/Me/Desktop/File.txt"))
{
    using (CryptoStream csEncrypt = new CryptoStream (file, encryptor, CryptoStreamMode.Write))
    {
        var s = new UniversalSerializer(csEncrypt, SerializerFormatters.BinarySerializationFormatter);
        s.Serialize(myString);
    }
}

The error:

ArgumentException: Stream was not readable.
System.IO.BinaryReader..ctor (System.IO.Stream input, System.Text.Encoding encoding, System.Boolean leaveOpen) (at <3a07e6401b5d4cc98f7be596cb2130ba>:0)
System.IO.BinaryReader..ctor (System.IO.Stream input, System.Text.Encoding encoding) (at <3a07e6401b5d4cc98f7be596cb2130ba>:0)
UniversalSerializerLib3.FileTools.BinaryReader2..ctor (System.IO.Stream input, System.Text.Encoding encoding) (at Assets/UniversalSerialier3.18.3.14/Common/BinaryReaderWriter2.cs:37)
UniversalSerializerLib3.BinaryDeserializationFormatter..ctor (UniversalSerializerLib3.Parameters parameters) (at Assets/UniversalSerialier3.18.3.14/Common/BinarySerializationFormatter.cs:229)
UniversalSerializerLib3.SerializationFormatter.ChooseDefaultDeFormatter (UniversalSerializerLib3.Parameters parameters) (at Assets/UniversalSerialier3.18.3.14/Common/Serializer.cs:113)
UniversalSerializerLib3.UniversalSerializer..ctor (UniversalSerializerLib3.Parameters parameters) (at Assets/UniversalSerialier3.18.3.14/Common/UniversalSerializer.cs:187)
UniversalSerializerLib3.UniversalSerializer..ctor (System.IO.Stream stream) (at Assets/UniversalSerialier3.18.3.14/Common/UniversalSerializer.cs:119)
CryptoStreamErrorExample.Save () (at Assets/CryptoStreamErrorExample.cs:46)
CryptoStreamErrorExample.Update () (at Assets/CryptoStreamErrorExample.cs:18)

Full Unity script:
CryptoStreamErrorExample.cs.txt

Is this a problem with UniversalSerializer or my code?

UWP error on Copy DLL Files

I'm trying to rebuild all the libraries in the correct formats but, no matter what, I always get an error:

Severity Code Description Project File Line Suppression State Error Could not copy the file "C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\DLL\uwp\universalserializer uwp\bin\x86\release\UniversalSerializer UWP.dll" because it was not found. Copy DLL files Error Could not copy the file "C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\DLL\uwp\universalserializer uwp\bin\x86\release\UniversalSerializer UWP.pdb" because it was not found. Copy DLL files Error Could not copy the file "C:\Users\massi\Documents\Source\UniversalSerializer_3.18.3.14\Source\DLL\uwp\universalserializer uwp\bin\x86\release\UniversalSerializer UWP.pri" because it was not found. Copy DLL files

Note that in order to have the UWP library complie I had to add JSON_DISABLED in the UWP project

UWP 64Bit reports an error on nuget

I'm writing an UWP app and when I try to compile it 64bit I get this:
Severity Code Description Project File Line Suppression State
Warning There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "C:\Users\massi.nuget\packages\universalserializer\3.18.4.15\lib\uap\UniversalSerializer UWP.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. SerializationTest

I installed universalserializer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.