FHIR Chat · type convert exception · dotnet

Stream: dotnet

Topic: type convert exception


view this post on Zulip Yunwei Wang (Jan 08 2019 at 23:11):

Not sure if this has been reported before. I used SearchParams.FromParameters() to convert from Parameter to SearchParams. The Parameter has one FhirString parameter. At run time, FromParameters() method throws exception:
Cannot convert 'FhirString' value 'diet' to string.
I am using R4 Nuget 0.96.0. Here is the StackTrace:

   at Hl7.Fhir.Serialization.PrimitiveTypeConverter.convertToXmlString(Object value)
   at Hl7.Fhir.Serialization.PrimitiveTypeConverter.ConvertTo(Object value, Type to)
   at Hl7.Fhir.Serialization.PrimitiveTypeConverter.ConvertTo[T](Object value)
   at Hl7.Fhir.Rest.SearchParams.FromParameters(Parameters parameters)
...

view this post on Zulip Brian Postlethwaite (Jan 10 2019 at 04:17):

Which base fhir version spec is that one?
(i.e. What is returned from ModelInfo.FhirVersion)

view this post on Zulip Yunwei Wang (Jan 10 2019 at 19:22):

3.3.0
Here is code segment which throws exception:

static void Main(string[] args)
        {
            var version = ModelInfo.Version;
            var parameters = new Parameters();
            parameters.Add("test", new FhirString("test string"));
            var searchParams = SearchParams.FromParameters(parameters);
        }

view this post on Zulip Brian Postlethwaite (Jan 11 2019 at 07:04):

That is an older version of the client, I don't think there is an official R4 NuGet package pushed just yet (apart from the alpha channel)


Last updated: Apr 12 2022 at 19:14 UTC