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

Authoring Support: Add WinRT Diagnostics #615

Merged
merged 57 commits into from
Dec 30, 2020
Merged

Conversation

j0shuams
Copy link
Contributor

@j0shuams j0shuams commented Dec 1, 2020

Background

Previously (before C#/WinRT) Winmdexp tool was used to generate a winmd file from C# code, for a WRC. See this link for a list of the scenarios Winmdexp looks for.

I am working on adding diagnostic checks to the C#/WinRT source generator to catch these same cases that Winmdexp did. As I have been working, my additions are growing in size. So, I thought it would be good to integrate them into our primary branch in pieces. For one thing, if there's any suggestions that affect the design/code in a large way, it's better to catch that now than down the road when even more code has been written.

The Work

This PR includes the work to add diagnostics for users authoring C#/WinRT components. Essentially, users could write some C# code that is not valid for a Windows Runtime Component (WRC).

The code I am introducing in this PR is

  • DiagnosticUtils and DiagnosticHelpers , new files in the WinRT.SourceGenerator project that handles all of the diagnostic checks
  • DiagnosticRules, another new file that holds all the DiagnosticDescriptor used for the rules (diagnostic messages)
  • a unit test app called DiagnosticTests , built with positive and negative data driven tests
  • updates to the existing Generator file in the SourceGenerator project, with calls to my functions

Contributes to #309

j0shuams and others added 2 commits December 23, 2020 15:14
* add tests for exposing invalid types

* consolidating signature checks

* splitting utilities into two files, catching (some) invalid types

* bool to void change

* using class fields instead of passing reference

* add namespace diagnostic, reorganize
* enumerable tests should be nongeneric
* add test for basetype and bad interface
* add case for basetype implementing not valid interfaces
* fix test names
* rename scanner
* clean up IsInvalidNamespace

* custom map, struct refactoring

* custom type mapping support

* Better custom type mapping support

* Add special case for AsyncAction
@j0shuams j0shuams changed the title Adding WinRT Diagnostics (Part 1) Authoring Support: Add WinRT Diagnostics Dec 30, 2020
@j0shuams j0shuams merged commit d1b538e into master Dec 30, 2020
@j0shuams j0shuams deleted the jlarkin/adding-diagnostics branch December 31, 2020 02:25
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