Skip to content

Copying the dictionary of properties on a PnpObject results in some properties returning the wrong type. #859

Closed

Description

I have a number of classes that wrap Windows.Devices.Enumeration.Pnp.PnpObject to provide easy accessors for properties I expect to be included in the Properties member. In the transition from .net framework 4.6.1 to .net 5, I started hitting an access violation: #635

As a work around to that issue, I started making a managed copy of the properties as part of the constructor for my wrapper classes. This seemed to work fine until recently. I don't have multiple test environments to verify but it seems as though updating Windows has caused this because it repros with the old nuget version I was using 1.1.4, and the latest 1.2.6. What happens is that named Pnp properties like "System.Devices.ContainerId" sometimes return an object of the wrong type.

I have attached a simple repro that executes the same code in a .net framework project referencing the winmd and a .net 5 project using the latest CSWinRT nuget package to illustrate the difference.

PNPBugRepro.zip

Edition Windows 10 Enterprise
Version 21H1
Installed on ‎5/‎15/‎2020
OS build 19043.985
Experience Windows Feature Experience Pack 120.2212.2020.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't workingfixedIssue has been fixed in an upcoming or existing release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions