Skip to content

VS OE: do not use object type for project metadata values  #10055

@dtivel

Description

@dtivel

Calling either INuGetProjectManagerService.GetMetadataAsync(...) or INuGetProjectManagerService.TryGetMetadataAsync(...) with NuGetProjectMetadataKeys.TargetFramework over a remote connection will serialize a NuGetFramework instance correctly but will not deserialize on the client as expected.

When the original data type is a built-in primitive (like string with NuGetProjectMetadataKeys.Name), the explicit casts here and here are successful.

However, when the original data type is NuGetFramework, these casts result in an InvalidCastException. Since the deserializer's only hint as to the expected type is object (from the interface method signatures), the deserializer deserializes the NuGetFramework as a dictionary of key-value pairs. NuGetFrameworkFormatter.Deserialize(...) is never called.

Presumably, NuGetProjectMetadataKeys.SupportedFrameworks has a similar problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions