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

Fix issue with ABI delegates in collections for .NET Standard projection #1330

Merged
merged 11 commits into from
Jun 8, 2023

Conversation

manodasanW
Copy link
Member

Our .NET Standard embedded projection can be used with both .NET core and .NET Framework. But it seems our generic collection types runs into issues with the latter due to using Expression.GetDelegateType to generate custom delegates with void* parameters doesn't seem to be supported there. To address that, in our .NET Standard projection, we are now code generating all the ABI delegates that we can detect as being needed while generating the projection. This is then used by the collection types for when they need the delegate via a lookup mechanism. There is a fallback to Expression.GetDelegateType which handles the scenario where we couldn't detect a certain ABI delegate is needed and didn't generate it as the WinRT boundary takes the value as an object. .NET Core users would be handled via that fallback, but .NET Framework users would see an error. In those cases, there is a way for the app to declare their own ABI delegates and register them if needed.

}

[Fact]
public void Test6()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We should improve the naming of these tests in the future

@manodasanW manodasanW merged commit 0afca0f into master Jun 8, 2023
@manodasanW manodasanW deleted the manodasanw/GetDelegateType branch June 8, 2023 18:42
dongle-the-gadget pushed a commit to dongle-the-gadget/CsWinRT that referenced this pull request Jul 29, 2023
…ion (microsoft#1330)

* Most of the changes to remove use of Expression.GetDelegateType for .NET standard projections

* Fix build

* Address issues to get test passing

* Fix tests

* Rearranage which files the delegates are generated in and scoping it to .NET Standard

* Add tests

* Enable test for Net Framework

* Scope delegates to NET Standard

* Update UnitTestEmbedded.csproj

* Handle edge case of generic type referencing another generic type.

* Minor clarifications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants