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

[release/5.0] Backport System.Speech to compat pack #46729

Merged
merged 11 commits into from
Jan 14, 2021

Conversation

danmoseley
Copy link
Member

@danmoseley danmoseley commented Jan 8, 2021

Backport System.Speech including its entry in the windows compat pack.
Original PR #45941

Customer Impact

The System.Speech assembly on .NET Framework does not work on .NET Core/.NET 5 because it uses private reflection. Many customers rely on generating speech from .NET code to make their apps or scripts accessible to them or their users. They have given us clear and extensive feedback on the impact this has on them, eg in the issue https:/dotnet/wpf/issues/2935. In particular this means they cannot generate speech from Powershell scripts, as recent versions of Powershell depend on .NET Core.

This change backports the port of System.Speech that we have completed in master, so that we can ship it in an updated Windows Compatibility Pack and enable this speech functionality for our customers using .NET 2.1+.

Testing

  • Unit tests that give ~50% coverage. That isn't great, but they cover the key synthesis/recognition paths. Much of the uncovered code are paths like event handlers, or code relating to generating or parsing custom grammars, etc that is not as relevant to generating basic speech which is the key use case we are trying to enable. There aren't quick wins to increase the coverage substantially, and the original tests are not feasible to port due to their structure.
  • Manually tested the System.Speech package as follows: net472->ns20, net472->net472, netcoreapp2.1->ns20, netcoreapp2.2->ns20, net50->ns2.0. Where a P2P is shown, code was exercised in both. Also verified a build error for netcoreapp2.0.
  • Manually tested the Windows Compat pack package (containing it) as follows: net50->ns20, netcoreapp21->ns20

Risk

The code forms its own library, not previously shipped, so it's highly unlikely that existing .NET Core users would be broken by shipping this library. If there was a break, it would presumably relate to a packaging issue (since it's included into the compatibility pack). We tested key scenarios around consuming the package.

* Initial sources, with banners

* Run the code formatter

* Fix hang in XUnit due to failing to complete all AsyncOperation-s

* Remove reflection over RegistryKey

* Add ref and packaging

* Add tests

* Add sln

* Fix CS1584

* Fix CA1823

* Fix CA1834

* Unnecessary suppressions

* Fix SA1028

* Fix CA1507

* Fix CA1810

* Fix CA1825

* Fix CA1825

* Unnecessary suppressions

* Fix CA1805

* Fix IDE0004

* Fix IDE0090

* Remove CAS

* Remove tabs and dead code

* Unnecessary suppressions

* Fix SA1212

* Fix SA1121

* Disable SA1129

* Fix SA1206

* Fix SA1518

* Fix SA1617

* Fix SA1001

* Fix CS0618

* Remove unnecessary comments

* Remove unnecessary whitespace

* Remove low value xml doc comments

* Unused usings

* dead files

* Remove CAS

* More junk

* Fix obvious original bug

* Remove/insert newlines

* Remove reference to old design document

* Fix spacing

* Fix typo name

* Fix file casing

* Remove dead code

* Add to compat pack

* Remove AppDomain etc

* Fix casing of .NET

* Remove low value XML docs

* Remove code that relies on compiling assemblies

* Fix inadvertently removed padding

* Use EDI to preserve stack when rethrowing

* Fix misaligned resource ID's to match sperror.h

* Skip SpeechRecognitionEngine tests if no installed recognizers

* Fix misformatted string bug

* Logging for CI error

* Fix NRE trying to map phonemes for voice for culture for which we do not have phoneme map

* Fix 153 spelling errors in comments using `Visual Studio Spell Checker`

* Remove extraneous file

* Fix spacing

* Fix project reference

* Reorder properties in csproj

* Change from netcoreapp2.0 to netcoreapp2.1

* Update src/libraries/System.Speech/pkg/System.Speech.pkgproj

Co-authored-by: Jose Perez Rodriguez <[email protected]>

* Add build error for targeting netcoreapp2.0

* Suppress new error during packaging testing

* Update System.Speech.targets

* Remove ref comments

* Update pkgproj

* Remove placeholder

Co-authored-by: Jose Perez Rodriguez <[email protected]>
Co-authored-by: Viktor Hofer <[email protected]>
@Dotnet-GitSync-Bot
Copy link
Collaborator

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@danmoseley
Copy link
Member Author

Test failure are #43981 and #11063

@ericstj
Copy link
Member

ericstj commented Jan 8, 2021

I suspect you'll need to cherry-pick bc24a14 from #46688 to get package testing to pass.

@danmoseley
Copy link
Member Author

@ericstj apparently I didn't, unless it's something not run in CI.

@danmoseley
Copy link
Member Author

Running pkg/tests locally i do get a bunch of errors like

C:\git\50runtime\artifacts\bin\testPkg\projects\System.Diagnostics.DiagnosticSource\netcoreapp1.0\project.csproj : error NU3005: Package 'Microsoft.NETCore.Platforms 1.0.2' from source 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder': The package signature file entry is invalid. The central directory header field 'compression method' has an invalid value (8). [C:\git\50runtime\src\libraries\pkg\test\testPackages.proj]

@danmoseley
Copy link
Member Author

Oh, silly mistake, I didn't remove the 5.0.2.

@ericstj
Copy link
Member

ericstj commented Jan 8, 2021

@ericstj apparently I didn't, unless it's something not run in CI.

Did you add the package to

<ProjectReference Include="$(LibrariesProjectRoot)\pkg\Microsoft.Windows.Compatibility\Microsoft.Windows.Compatibility.pkgproj" Condition="'$(BuildAllConfigurations)' == 'true'" />
? If not it won't build during servicing.

Double check the steps here: https:/dotnet/runtime/blob/release/5.0/docs/project/library-servicing.md

@danmoseley
Copy link
Member Author

danmoseley commented Jan 9, 2021

OK added to libraries-packages.proj. Checked library-servicing.md.

Also found it didn't work on .NET Framework -- fixed public key to MicrosoftShared to fix that. Also tested net472->ns20, net472->net472, netcoreapp2.1->ns20, netcoreapp2.2->ns20, netcoreapp2.0 (build error), net50->ns2.0.

Strangely something is updating packageIndex.json by itself to add lots of "5.0.2" entries. I'll see whether it's the build..

@danmoseley
Copy link
Member Author

Yes, when I do build clr+libs+libs.tests -rc release -allconfigurations -pack I get this edit created for me:

diff --git a/src/libraries/pkg/baseline/packageIndex.json b/src/libraries/pkg/baseline/packageIndex.json
index cff6d7f372d..176476355a1 100644
--- a/src/libraries/pkg/baseline/packageIndex.json
+++ b/src/libraries/pkg/baseline/packageIndex.json
@@ -23,7 +23,8 @@
     "Microsoft.Bcl.AsyncInterfaces": {
       "StableVersions": [
         "1.0.0",
-        "5.0.0"
+        "5.0.0",
+        "5.0.2"
       ],
       "BaselineVersion": "5.0.0",
       "InboxOn": {},
@@ -137,7 +138,8 @@
         "2.0.0",
         "2.0.1",
         "2.1.0",
-        "5.0.0"
+        "5.0.0",
+        "5.0.2"
       ],
       "BaselineVersion": "5.0.0",
       "InboxOn": {},
@@ -170,7 +172,8 @@
         "3.1.0",
         "3.1.1",
         "3.1.2",
-        "5.0.0"
+        "5.0.0",
+        "5.0.2"
       ],
       "InboxOn": {},
       "AssemblyVersionInPackageVersion": {
@@ -199,7 +202,8 @@
         "3.1.0",
         "3.1.1",
         "3.1.2",
-        "5.0.0"
+        "5.0.0",
+        "5.0.2"
       ],
       "InboxOn": {},
etc etc

is that an issue?

@janvorli
Copy link
Member

Yes, when I do build clr+libs+libs.tests -rc release -allconfigurations -pack I get this edit created for me

I've also noticed it happens whenever I try to build the 5.0 branch locally.

@danmoseley
Copy link
Member Author

Need to cherry pick #46841

@danmoseley danmoseley changed the title [release/5.0] Backport System.Speech [release/5.0] Backport System.Speech to compat pack Jan 12, 2021
@danmoseley danmoseley added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Jan 12, 2021
@danmoseley
Copy link
Member Author

Marking no merge until I can cherry pick #46841 shortly

@leecow leecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Jan 12, 2021
@leecow leecow added this to the 5.0.3 milestone Jan 12, 2021
* Fix PKT

* Fix SAPI errors

* Disable test as appropriate

* enable more tests to fail to get messages

* reenable tests

* Update src/libraries/System.Speech/tests/SpeechRecognizerTests.cs

Co-authored-by: Stephen Toub <[email protected]>

Co-authored-by: Stephen Toub <[email protected]>
@danmoseley danmoseley removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Jan 12, 2021
@danmoseley
Copy link
Member Author

@ericstj any other feedback? if you can approve, we can presumably merge.

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

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

LGTM. I think @Anipik needs to merge this once he does branding and will need to address merge conflicts.

@ericstj ericstj requested a review from Anipik January 13, 2021 03:07
@danmoseley
Copy link
Member Author

OK thanks! @Anipik I will be happy to validate this when we have product installer that includes it.

@Anipik
Copy link
Contributor

Anipik commented Jan 13, 2021

OK thanks! @Anipik I will be happy to validate this when we have product installer that includes it.

i am waiting on this #46888 to be green. After that i will start merging the changes.

@Anipik
Copy link
Contributor

Anipik commented Jan 14, 2021

Yes, when I do build clr+libs+libs.tests -rc release -allconfigurations -pack I get this edit created for me:

This is being fixed here #46224

@Anipik Anipik merged commit f5f2e4f into dotnet:release/5.0 Jan 14, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Feb 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Speech Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants