UniversalSerializer icon indicating copy to clipboard operation
UniversalSerializer copied to clipboard

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

Open Bobbeo opened this issue 7 years ago • 0 comments

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.

Bobbeo avatar Jun 18 '18 07:06 Bobbeo