Can you attach the patch?I can't get it from gmail as it is now.
On Mon, Jun 15, 2009 at 6:07 AM, thuannguy <[email protected]> wrote:
>
> Recently I updated Rhino Service Bus code and suddenly my code
> failed :-D After investigating a bit, I found out it is broken
> because of this commit:
>
> Revision: 2168
> Author: ayenderahien
> Date: 1:26:43 AM, Tuesday, June 02, 2009
> Message:
> Patch from João P. Bragança - for Version Information Included
> with Generic Types
> ----
> Modified : /trunk/esb/Rhino.ServiceBus/Impl/DefaultReflection.cs
> Modified : /trunk/esb/Rhino.ServiceBus.Tests/
> DefaultReflectionTests.cs
>
> The case is simple: I have a SerializableDictionary which is defined
> in the "AAAAA.Common" assembly.
>
> defaultReflection.GetAssemblyQualifiedNameWithoutVersion(typeof
> (SerializableDictionary<string,string>)) returns:
>
> "System.Collections.SerializableDictionary`2[[string],[string]],
> AAAAA.Common"
>
> but the correct one should be:
>
> "System.Collections.SerializableDictionary`2[[System.String],
> [System.String]], AAAAA.Common"
>
> You can use Type.GetType() to test: the former returns null while the
> latter returns the correct Type object.
>
> Below is the quick fix I made which work for me. However, as I pointed
> out in
>
> Gets_assembly_name_without_version_for_generic_types_with_more_than_one_type_parameter_in_local_assemblies
> test case, this is not a complete fix.
>
>
> //-----------------------------------------------------------------------------------------------------------------------------------------------------------------//
> Index: D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus/Convertors/ThrowingWireEcryptedStringConvertor.cs
> ===================================================================
> --- D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus/Convertors/ThrowingWireEcryptedStringConvertor.cs
> (revision 2203)
> +++ D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus/Convertors/ThrowingWireEcryptedStringConvertor.cs
> (working copy)
> @@ -17,7 +17,7 @@
>
> public WireEcryptedString FromElement(XElement element)
> {
> - var value = element.Element(XName.Get("Value",
> "string"));
> + var value = element.Element(XName.Get("Value",
> "System.String"));
> if(value==null)
> throw new SerializationException("<WireEcryptedString>
> did not have mandatory <Value> element");
> return new WireEcryptedString
>
> Index: D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus/Convertors/WireEcryptedStringConvertor.cs
> ===================================================================
> --- D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus/Convertors/WireEcryptedStringConvertor.cs (revision
> 2203)
> +++ D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus/Convertors/WireEcryptedStringConvertor.cs (working
> copy)
> @@ -24,7 +24,7 @@
>
> public WireEcryptedString FromElement(XElement element)
> {
> - var value = element.Element(XName.Get("Value","string"));
> + var value = element.Element(XName.Get
> ("Value","System.String"));
> if(value==null)
> throw new ArgumentException("element must contain
> <value> element");
>
>
> Index: D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus/Impl/DefaultReflection.cs
> ===================================================================
> --- D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus/Impl/DefaultReflection.cs (revision 2203)
> +++ D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus/Impl/DefaultReflection.cs (working copy)
> @@ -29,20 +29,20 @@
> wellKnownTypeNameToType = new Dictionary<string, Type>();
> typeToWellKnownTypeName = new Dictionary<Type, string>
> {
> - {typeof (string), "string"},
> - {typeof (int), "int"},
> - {typeof (byte), "byte"},
> - {typeof (bool), "bool"},
> - {typeof (DateTime), "datetime"},
> - {typeof (TimeSpan), "timespan"},
> - {typeof (decimal), "decimal"},
> - {typeof (float), "float"},
> - {typeof (double), "double"},
> - {typeof (char), "char"},
> - {typeof (Guid), "guid"},
> - {typeof (Uri), "uri"},
> - {typeof (short), "short"},
> - {typeof (long), "long"},
> + {typeof (string), typeof (string).FullName},
> + {typeof (int), typeof (int).FullName},
> + {typeof (byte), typeof (byte).FullName},
> + {typeof (bool), typeof (bool).FullName},
> + {typeof (DateTime), typeof (DateTime).FullName},
> + {typeof (TimeSpan), typeof (TimeSpan).FullName},
> + {typeof (decimal), typeof (decimal).FullName},
> + {typeof (float), typeof (float).FullName},
> + {typeof (double), typeof (double).FullName},
> + {typeof (char), typeof (char).FullName},
> + {typeof (Guid), typeof (Guid).FullName},
> + {typeof (Uri), typeof (Uri).FullName},
> + {typeof (short), typeof (short).FullName},
> + {typeof (long), typeof (long).FullName},
> {typeof(byte[]), "binary"}
> };
> foreach (var pair in typeToWellKnownTypeName)
>
> Index: D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus.Tests/DefaultReflectionTests.cs
> ===================================================================
> --- D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus.Tests/DefaultReflectionTests.cs (revision 2203)
> +++ D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus.Tests/DefaultReflectionTests.cs (working copy)
> @@ -78,6 +78,7 @@
> var output =
> reflection.GetAssemblyQualifiedNameWithoutVersion(typeof
> (GenericConsumer<SomeMsg>));
>
> Assert.DoesNotContain
> ("Rhino.ServiceBus.Tests,Version=", output.Replace(" ", ""));
> + Assert.NotNull(Type.GetType(output)); // still
> fail!!!
> }
> [Fact]
> public void
> Gets_assembly_name_with_more_than_one_type_parameter()
> @@ -86,7 +87,18 @@
> Assert.Equal(
> typeof(Dictionary<object,
> object>).AssemblyQualifiedName,
> name);
> + var type = Type.GetType(name);
> }
> +
> + [Fact]
> + public void
>
> Gets_assembly_name_without_version_for_generic_types_with_more_than_one_type_parameter_in_local_assemblies
> ()
> + {
> + string name =
> reflection.GetAssemblyQualifiedNameWithoutVersion(typeof
> (TestDictionary<string, string>));
> + var type = Type.GetType(name);
> + Assert.NotNull(type); // fail if not apply my fix!!!
> + }
> +
> +
> public class SomeMsg{}
> public class SomeMsgConsumer:GenericConsumer<SomeMsg>{}
> public class GenericConsumer<T>:ConsumerOf<T>
> @@ -148,6 +160,10 @@
> }
> }
> }
> + public class TestDictionary<T, TK> : Dictionary<T, TK>
> + {
>
> + }
> +
>
> }
>
> Index: D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus.Tests/When_Security_Is_Specified_In_Config.cs
> ===================================================================
> --- D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus.Tests/When_Security_Is_Specified_In_Config.cs
> (revision 2203)
> +++ D:/CatGlobe/SOURCES/CatTask-references/Rhino tools/esb/
> Rhino.ServiceBus.Tests/When_Security_Is_Specified_In_Config.cs
> (working copy)
> @@ -54,7 +54,7 @@
>
> public const string encryptedMessage =
> @"<?xml version=""1.0"" encoding=""utf-8""?>
> -<esb:messages xmlns:esb=""http://servicebus.hibernatingrhinos.com/
> 2008/12/20/esb""
>
> xmlns:tests.classwithsecretfield=""Rhino.ServiceBus.Tests.When_Security_Is_Specified_In_Config
> +ClassWithSecretField, Rhino.ServiceBus.Tests""
>
> xmlns:datastructures.wireecryptedstring=""Rhino.ServiceBus.DataStructures.WireEcryptedString,
> Rhino.ServiceBus"" xmlns:string=""string"">
> +<esb:messages xmlns:esb=""http://servicebus.hibernatingrhinos.com/
> 2008/12/20/esb""
>
> xmlns:tests.classwithsecretfield=""Rhino.ServiceBus.Tests.When_Security_Is_Specified_In_Config
> +ClassWithSecretField, Rhino.ServiceBus.Tests""
>
> xmlns:datastructures.wireecryptedstring=""Rhino.ServiceBus.DataStructures.WireEcryptedString,
> Rhino.ServiceBus"" xmlns:string=""System.String"">
> <tests.classwithsecretfield:ClassWithSecretField>
> <datastructures.wireecryptedstring:ShouldBeEncrypted>
> <string:Value
> iv=""0yL9+t0uyDy9NeP7CU1Wow=="">q9a10IFuRxrzFoZewfdOyg==</
> string:Value>
> @@ -84,7 +84,7 @@
> .Element(XName.Get("messages", "http://
> servicebus.hibernatingrhinos.com/2008/12/20/esb"))
> .Element(XName.Get
>
> ("ClassWithSecretField","Rhino.ServiceBus.Tests.When_Security_Is_Specified_In_Config
> +ClassWithSecretField, Rhino.ServiceBus.Tests"))
> .Element(XName.Get
> ("ShouldBeEncrypted","Rhino.ServiceBus.DataStructures.WireEcryptedString,
> Rhino.ServiceBus"))
> - .Element(XName.Get("Value","string"))
> + .Element(XName.Get("Value","System.String"))
> .Value;
>
> Assert.NotEqual("abc", actual);
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---