runtime: System.NullReferenceException when using System.Speech 7.0.0-rc.1.22426.10 from Windows Forms
.NET version
.NET 7.0.0
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
.NET 6.0.0
Issue description
When trying to use the latest version of System.Speech from Windows Forms, it throws a System.NullReferenceException while trying to access the SpeechSynthesizer class.
Steps to reproduce
Run the attached project and click the button.
private void Button_Click(object sender, EventArgs e)
{
label.Text = string.Empty;
using var speech = new SpeechSynthesizer();
// System.Speech 7.0.0-rc.1.22426.10 throws System.NullReferenceException exception here.
speech.SetOutputToDefaultAudioDevice();
speech.SelectVoiceByHints(VoiceGender.Female);
speech.SpeakProgress += (sender, e) => { label.Text += $"{e.Text} "; };
speech.Speak("This is a test of the SpeechSynthesizer class.");
label.Text += "\r\nFinished speaking...\r\n";
}
Expected: The speech synthesizer should read out the contents of the string.
Actual: Accessing the newly created speech SpeechSynthesizer object throws a System.NullReferenceException exception.
Repro project: WinFormsSpeechRepro.zip
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (15 by maintainers)
So far just a fun hobby project converting English to Deseret through IPA by replacing the IPA phonemes with the equivalent characters from the Deseret alphabet. I use the speech synthesizer to read out the English and IPA text to hear the differences.
@Shkyrockett, thanks for the bug report and helping us to get this fixed.