GithubHelp home page GithubHelp logo

Comments (12)

udidahan avatar udidahan commented on July 24, 2024

We don't want to support/encourage the use of untyped data in message schema.
Can you explain what information your moving around here and what the context of the message is?

from nservicebus.

fvuksan avatar fvuksan commented on July 24, 2024

Hi,
I have generic message class that contains three common parameters with specific meaning and dictionary for all other needs. I suppose I could use inheritance and name all parameters but I obviously didn't :-). Anyway, using dictionary should be either explicitly forbidden or fixed. This way it just doesn't work and that is confusing.

from nservicebus.

udidahan avatar udidahan commented on July 24, 2024

Dictionaries are supported - it's just that generics of object aren't. For example, you can use Dictionary of string and string.

from nservicebus.

fvuksan avatar fvuksan commented on July 24, 2024

I just wanted to point out that Dictionary of string and object serialization works and deserialization fails silently. However you look at it, that isn't good behaviour.

from nservicebus.

fvuksan avatar fvuksan commented on July 24, 2024

Sorry, I pressed wrong button.

from nservicebus.

andreasohlund avatar andreasohlund commented on July 24, 2024

Udi: What should we do here ? a better exception?

from nservicebus.

udidahan avatar udidahan commented on July 24, 2024

Yes, a better exception - I think we can generalize the check to yell about anything which is of the type "object".

from nservicebus.

andreasohlund avatar andreasohlund commented on July 24, 2024

Joseph:

Add a test: When_serializing_a_property_with_idictionary_object
It should throw an exception saying that its not supported

And make the above change

from nservicebus.

Jpattom avatar Jpattom commented on July 24, 2024

For IDictionary the Test and Exception is already there
Here is the Log
[exec] Errors and Failures:
[exec] 1) Test Error : NServiceBus.Serializers.XML.Test.SerializerTests.Comparison
[exec] System.NotSupportedException : IDictionary<T, K> is not a supported property type for serialization, use
Dictionary<T,K> instead. Type: NServiceBus.Serializers.XML.Test.IM2 Property: AnyFoos. Consider using a concrete Dictionary<T, K> instead.

Do we need same kind of exception while using Dictionary<object, object> ?

from nservicebus.

andreasohlund avatar andreasohlund commented on July 24, 2024

Yes, Dictionary<string,string> is supported, it's the use of "object" that is not supported.
Add the following test:
When_using_a_dictionary_with_an_object_key_or_value
It Should throw an exception telling the user that untyped dictionaries is not supported
/Andreas

http://andreasohlund.net

http://twitter.com/andreasohlund

Date: Sat, 13 Aug 2011 23:41:33 -0700
From: [email protected]
To: [email protected]
Subject: Re: [NServiceBus] Dictionary<string,object> deserialization problem (#65)

For IDictionary the Test and Exception is already there
Here is the Log
[exec] Errors and Failures:
[exec] 1) Test Error : NServiceBus.Serializers.XML.Test.SerializerTests.Comparison
[exec] System.NotSupportedException : IDictionary<T, K> is not a supported property type for serialization, use
Dictionary<T,K> instead. Type: NServiceBus.Serializers.XML.Test.IM2 Property: AnyFoos. Consider using a concrete Dictionary<T, K> instead.

Do we need same kind of exception while using Dictionary<object, object> ?

Reply to this email directly or view it on GitHub:
#65 (comment)

from nservicebus.

Jpattom avatar Jpattom commented on July 24, 2024

Please Look for the fix and Unit test cases.

from nservicebus.

andreasohlund avatar andreasohlund commented on July 24, 2024

Looks good (I've made a minor comment in the commit)

from nservicebus.

Related Issues (20)

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.