Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
v-tbert opened this issue Jun 4, 2021 · 0 comments · Fixed by #932
Assignees
Labels
bug Something isn't working fixed Issue has been fixed in an upcoming or existing release
Milestone

Comments

@v-tbert
Copy link

v-tbert commented Jun 4, 2021

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

@v-tbert v-tbert added the bug Something isn't working label Jun 4, 2021
@angelazhangmsft angelazhangmsft added this to the Release 1.2.8 milestone Jun 10, 2021
@ujjwalchadha ujjwalchadha linked a pull request Jul 27, 2021 that will close this issue
@angelazhangmsft angelazhangmsft added the fixed Issue has been fixed in an upcoming or existing release label Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Issue has been fixed in an upcoming or existing release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants