I have created the following program with the help of some internet resources to create Jarvis:
namespace JarvisFile1
{
public partial class Form1 : Form
{
private void Form1_Load(object sender, EventArgs e)
{
_recognizer.SetInputToDefaultAudioDevice();
_recognizer.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(File.ReadAllLines(@"C:\Users\Nelson\Documents\JarvisCommands\greetings.txt")))));
_recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(_recognizer_SpeechRecognized);
_recognizer.RecognizeAsync(RecognizeMode.Multiple);
}
SpeechRecognitionEngine _recognizer = new SpeechRecognitionEngine();
SpeechSynthesizer JARVIS = new SpeechSynthesizer();
string QEvent;
string ProcWindow;
double timer = 10;
int count = 1;
Random rnd = new Random();
public Form1()
{
InitializeComponent();
}
void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
int ranNum = rnd.Next(1, 10);
string speech = e.Result.Text;
switch (speech)
{
//GREETINGS
case "hello":
case "hello jarvis":
if (ranNum < 6) { JARVIS.Speak("Hello sir"); }
else if (ranNum > 5) { JARVIS.Speak("Hi"); }
break;
case "goodbye":
case "goodbye jarvis":
case "close":
case "close jarvis":
JARVIS.Speak("Until next time");
Close();
break;
case "jarvis":
if (ranNum < 5) { QEvent = ""; JARVIS.Speak("Yes sir"); }
else if (ranNum > 4) { QEvent = ""; JARVIS.Speak("Yes?"); }
break;
}
}
}
}
The compiler compiles it perfectly at first and then gives the following error message:
"Managed Debugging Assistant 'RaceOnRCWCleanup' has detected a problem in 'C:\Users\Nelson\Documents\Visual Studio 2013\Projects\JarvisFile1\JarvisFile1\bin\Debug\JarvisFile1.vshost.exe'.
Additional information: An attempt has been made to free an RCW that is in use. The RCW is in use on the active thread or another thread. Attempting to free an in-use RCW can cause corruption or data loss."
I am not quite sure what this means as i am a beginner to coding. Any help to resolve this problem would be much appreciated. I can provide further debugging logs if required. I am using windows 8 and visual studio 2013.
The logs are given below:
'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'c:\users\nelson\documents\visual studio 2013\Projects\JarvisFile1\JarvisFile1\bin\Debug\JarvisFile1.vshost.exe'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Deployment\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Deployment.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Cannot find or open the PDB file. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Speech\v4.0_4.0.0.0__31bf3856ad364e35\System.Speech.dll'. Cannot find or open the PDB file. The thread 0x1cf4 has exited with code 259 (0x103). The thread 0x11f8 has exited with code 259 (0x103). The thread 0xd6c has exited with code 0 (0x0). The thread 0x23c has exited with code 0 (0x0). The thread 0x610 has exited with code 259 (0x103). 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'c:\users\nelson\documents\visual studio 2013\Projects\JarvisFile1\JarvisFile1\bin\Debug\JarvisFile1.exe'. Symbols loaded. 'JarvisFile1.vshost.exe' (CLR v4.0.30319: JarvisFile1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Cannot find or open the PDB file. JarvisFile1.vshost.exe Information: 0 : SAPI does not implement phonetic alphabet selection. The thread 0x2270 has exited with code 259 (0x103). The thread 0x1b8 has exited with code 259 (0x103). The thread 0x1c2c has exited with code 259 (0x103). The thread 0x1650 has exited with code 259 (0x103). The program '[9444] JarvisFile1.vshost.exe: Program Trace' has exited with code 0 (0x0). The program '[9444] JarvisFile1.vshost.exe' has exited with code 0 (0x0).