0

.NET framework tested against:

.NET framework 4.5.1.

Visual Studio tested against:

VS ultimate 2013.

Description:

I have created a WCF service that returns a Hashtable as output, when I have added the service reference within a class path library project I have obtained ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType as a Hashtable output result.

My class path library project references two DLL's: DocumentFormat.OpenXml and Newtonsoft.Json when I have deleted these DLL's and I have updated again the WCF service as consequence the conflict is solved and I obtained a hashtable as output result

How to obtain a Hashtable as output result instead of ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType?

unknownUser
  • 125
  • 2
  • 3
  • 10
  • How to obtain a Hashtable as output result instead of ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType ? – unknownUser Aug 22 '14 at 10:53
  • How are you exposing and consuming the service? Any code? – Patrick Hofman Aug 22 '14 at 10:54
  • Khmm, if your question is "How to obtain a Hashtable as output result instead of ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType", then it should be named accordingly. If your 4.0 project produced another type, then ask why it is so and what can be done (just read http://stackoverflow.com/questions/16657982/wcf-returns-arrayofkeyvalueofintstringkeyvalueofintstring-instead-of-dictionar before asking). – Eugene Podskal Aug 22 '14 at 10:57
  • The conflict appear when I upgraded the class path library project to .NET 4.5.1. After deleting DocumentFormat.OpenXml and Newtonsoft.Json DLL's I have obtained Hashtable as output result. – unknownUser Aug 22 '14 at 10:58

1 Answers1

1

You see the error because you are 'reuse types in referenced assemblies'. The generator picks the type out of the Newtosoft.Json dll or the document.openxml dll. And adds an using to a namespace in these dlls. You can exclude theres dll by selecting Reuse types in specified referenced assemblies and include the ones you need. Or specify the Dictionary collection type and Collection type under Data Type.

Peter
  • 27,590
  • 8
  • 64
  • 84
  • I have unchecked "reuse types in referenced assemblies" and the same problem occurs. – unknownUser Aug 22 '14 at 11:18
  • You can create a sample as WCF project that contains a service returning an empty Hashtable for example and try to invoke it by a console application but within your client you should include Newtonsoft.Json or/and DocumentFormat.OpenXml as result you will obtain ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType instead of dictionary collection. – unknownUser Aug 22 '14 at 15:09
  • Issue solved when I excluded DocumentFormat.OpenXml and Newtonsoft.Json DLL's from the service reference options. – unknownUser Aug 22 '14 at 15:44