0

I have a few classes with methods defined in a NuGet package. Some of these methods have "out parameters" and it seems that when I try to call these methods with out keyword an exception of type System.ServiceModel.CommunicationException is thrown.

Does anyone know why this exception is being thrown?

Are out parameters not allowed when calling Nuget packages?

I tried to bind each parameter manually using colons but I still see the same issue.

System.ServiceModel.CommunicationException: There was an error while trying to serialize parameter http://tempuri.org/:personalCode. The InnerException message was 'Type 'Personal' with data contract name 'Personal:http://schemas.datacontract.org/2004/07/DataContracts' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details. ---> System.Runtime.Serialization.SerializationException: Type 'PersonalCode' with data contract name 'PersonalCode:http://schemas.datacontract.org/2004/07/DataContracts' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

Nico
  • 12,493
  • 5
  • 42
  • 62
Rimoun
  • 455
  • 1
  • 9
  • 16
  • Please show how you are calling this function, and how the function itself is defined. – Ron Beyer Mar 13 '18 at 03:47
  • You need either ref or out in the parameter call so the value get send as a pointer instead of By value. By Value will put values on the execution stack. – jdweng Mar 13 '18 at 03:49
  • I think th e`out` parameters are a red herring, have you seen these two articles: https://forum.uipath.com/t/error-while-opening-the-packages-manager-window/1100/3 and less relevant https://social.msdn.microsoft.com/Forums/vstudio/en-US/0f41fde9-b589-4457-9760-7de0ad87e5e4/wcf-type-applicationexception-with-data-contract-name-is-not-expected?forum=wcf – Jeremy Thompson Mar 13 '18 at 03:50

0 Answers0