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 invalid cast exception with stream APIs and make code fixer emit diagnostics as warnings #1654

Merged
merged 5 commits into from
Jul 2, 2024

Conversation

manodasanW
Copy link
Member

@manodasanW manodasanW commented Jul 1, 2024

  • Added a new CsWinRTAotWarningLevel property to control whether the warnings from the code fixer are emitted as warnings or info. By default, for scenarios involving non built-in types, they will be emitted as warnings and built-in types will be emitted as info. The property can be used to control that behavior.
  • Fix InvalidCastException when using the stream extension APIs. The stream extension APIs make use of generic types and AsyncInfo.Run, but given we disable the lookup table generation on the Windows SDK projection, they are not automatically made AOT safe. Due to that, adding a manual implementation of what would get generated and only initializing it from the stream scenarios so that other scenarios can just trim it if the stream extension APIs are not used.

Fixes #1634
Fixes #1649

docs/aot.md Outdated Show resolved Hide resolved
nuget/readme.md Outdated Show resolved Hide resolved
manodasanW and others added 2 commits July 1, 2024 00:21
@lhak
Copy link

lhak commented Jul 1, 2024

Thank you for trying to fix #1634. Unfortunately, I still see the same issue with this patch. Interestingly, if I copy StreamTaskAdaptersImplementation.cs to my application and make sure its Init() method has been called, it works.

@manodasanW
Copy link
Member Author

manodasanW commented Jul 1, 2024

Thank you for trying to fix #1634. Unfortunately, I still see the same issue with this patch. Interestingly, if I copy StreamTaskAdaptersImplementation.cs to my application and make sure its Init() method has been called, it works.

Did you just use the updated WinRT.Runtime.dll or did you also build the Windows SDK projection? The stream changes are in the Windows SDK projection (Microsoft.Windows.SDK.NET.dll) so they will need that to be regenerated.

@lhak
Copy link

lhak commented Jul 1, 2024

Ok, I thought the updated code was in WinRT.Runtime.dll and I only used an updated cswinrt nuget package. So I guess everything will be fine once an updated Windows SDK nuget package is available.

@manodasanW manodasanW merged commit c3ebc1d into staging/AOT Jul 2, 2024
10 checks passed
@manodasanW manodasanW deleted the manodasanw/streams branch July 2, 2024 07:31
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.

None yet

3 participants