I tried hard with a lot of methods:
dte.ExecuteCommand("View.C#Interactive");
Even tried deleting temp file bin …..etc
I’m also changing view. C# Interactive to other and using ,0
Nothing worked. I asked chat and it didn’t work.
I’m getting an error shown in the screenshot.
Full ExecuteCommand tried is :
try
{
EnvDTE.Window interactiveWindow = dte.Windows.Item("{0AD07096-BBAE-4166-8293-27ED14E16448}");
// This must be done on the main thread
ThreadHelper.JoinableTaskFactory.Run(async () =>
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
interactiveWindow.Activate();
});
}
catch (Exception)
{
// 2. If activation fails, execute the command to open it.
try
{
dte.ExecuteCommand("View.C#Interactive");
}
catch (Exception ex)
{
MessageBox.Show($"Could not open C# Interactive Window: {ex.Message}");
return;
}
}
// *** END FIX FOR COMException ***
// 3. Send commands
System.Windows.Forms.Clipboard.SetText($"{script}\n{invocation}");
dte.ExecuteCommand("Edit.Paste");
System.Windows.Forms.SendKeys.SendWait("{ENTER}");