Implementation of Visual Studio Interactive Window.
dotnet / interactive-window Goto Github PK
View Code? Open in Web Editor NEWVisual Studio Interactive Window
License: MIT License
Visual Studio Interactive Window
License: MIT License
F# Interactive #help
shows these options:
#r "file.dll";; Reference (dynamically load) the given DLL
#I "path";; Add the given search path for referenced DLLs
#load "file.fs" ...;; Load the given file(s) as if compiled and referenced
#time ["on"|"off"];; Toggle timing on/off
#help;; Display help
#quit;; Exit
F# Interactive command line options:
See 'fsi --help' for options
C# Interactive #help
shows these options:
Keyboard shortcuts:
Enter If the current submission appears to be complete, evaluate it. Otherwise, insert a new line.
Escape Clear the current submission.
UpArrow Replace the current submission with a previous submission.
DownArrow Replace the current submission with a subsequent submission (after having previously navigated backwards).
Ctrl-C Exit the REPL.
REPL commands:
#help Display help on available commands and key bindings.
Script directives:
#r Add a metadata reference to specified assembly and all its dependencies, e.g. #r "myLib.dll".
#load Load specified script file and execute it, e.g. #load "myScript.csx".
One of the great features of F# scripts is the #I
directive, which tells F# Interactive where to look for referenced DLLs.
Is there an equivalent way to do this in C# scripts?
Microsoft.VisualStudio.VsInteractiveWindow 2.3.0 depends on
Microsoft.VisualStudio.Editor (>= 15.0.26201-alpha) but
Microsoft.VisualStudio.Editor 15.0.26201-alpha was not found.
An approximate best match of Microsoft.VisualStudio.Editor 15.0.26201 was resolved.
ditto others like
Microsoft.VisualStudio.VsInteractiveWindow 2.3.0 depends on
Microsoft.VisualStudio.ComponentModelHost (>= 15.0.26201-alpha)
Requires targeting 16.4
Tracking TODO in .editorconfig.
microsoft/RTVS#2637
It needs to check Dispatcher.HasShutdownStarted inside InteractiveWindow.UIThread methods
Tracking TODO in .editorconfig.
Reported at developer community as https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1178927.
Workflow:
var a = 5;
Expected Outcome:
The current line should match the previous entry and read var a = 5;
Actual Outcome:
No change to the current line. From debugging the CommandFilter, pguidCmdGroup
is VsStd12 and the nCmdID
is MoveSelLinesUp.
Tracking TODO in .editorconfig.
(Moving from microsoft/PTVS#226)
Because each coloured text span is added individually, it is very slow to write large blocks of coloured text (for example, tracebacks in IPython mode).
microsoft/PTVS@451083a was the fix applied to the PTVS version of the interactive window. Would be nice to port this into this one.
Is csi.exe open-sourced somewhere? I don't know if it is appropriate to ask here but I'm quite curious about how csi is implemented.
1+1 <ENTER>
is read correctly but the resulting 2
is silent.Tracking TODO in .editorconfig.
When standard UI thread loop is replaced with JoinableTaskFactory
job, Dispatcher.Invoke
is blocked until job is completed. This may end up in a deadlock if calling code has switched from UI thread to background using СonfigureAwait(false)
or any other custom awaiter.
Issue can be easily got around by calling all interactive window methods from UI thread, but it eliminates the advantage of calling IInteractiveWindow.Write
from background thread. Maybe this method can use BeginInvoke
instead.
Scenario: User inputs some command into interactive window. InteractiveEvaluator.ExecuteCodeAsync switches to background thread and waits until command is completed. Command produces some output which we have to print to user while it is coming. If command produces too much output and for each of it we have to create a task in Dispatcher, we get too many of them which is noticeable by user.
VS has a bug where toolbars (as identified by GUID/cmdid) appearing in multiple tool windows will share some visibility state for their icons. This results in icons added to the Python interactive appearing in the C# interactive:
VSPlat has acknowledged and wontfix'd the bug (you can also see it affect Solution Explorer if you open a second instance), and the best workaround for us is to have each user of the window provide their own toolbar.
Tracking TODO in .editorconfig.
Awaiting functions in my library causes the interactive window to hang. Running the same functions in csi.exe causes it to crash with the following error:
System.IO.FileNotFoundException: Could not load file or assembly 'System.ComponentModel.TypeConverter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'System.ComponentModel.TypeConverter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType) at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters() at System.Reflection.RuntimeMethodInfo.GetParameters() at Microsoft.CodeAnalysis.Scripting.Hosting.CommonObjectFormatter.FormatMethodSignature(MethodBase method) at Microsoft.CodeAnalysis.Scripting.Hosting.CommonObjectFormatter.FormatException(Exception e) at Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineRunner.DisplayException(Exception e) at Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineRunner.BuildAndRun(Script'1 newScript, InteractiveScriptGlobals globals, ScriptState'1& state, ScriptOptions& options, Boolean displayResult, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineRunner.RunInteractiveLoop(ScriptOptions options, String initialScriptCodeOpt, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineRunner.RunInteractiveCore(ErrorLogger errorLogger) at Microsoft.CodeAnalysis.Scripting.Hosting.CommandLineRunner.RunInteractive() at Microsoft.CodeAnalysis.CSharp.Scripting.Hosting.Csi.Main(String[] args)
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]
Running in the interactive window with assembly bind failure logging turned on returns the following error
Unexpected error: System.IO.FileNotFoundException: Could not load file or assembly 'System.ComponentModel.TypeConverter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'System.ComponentModel.TypeConverter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType) at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters() at System.Reflection.RuntimeMethodInfo.GetParameters() at Microsoft.CodeAnalysis.Scripting.Hosting.CommonObjectFormatter.FormatMethodSignature(MethodBase method) at Microsoft.CodeAnalysis.Scripting.Hosting.CommonObjectFormatter.FormatException(Exception e) at Microsoft.CodeAnalysis.CSharp.Scripting.Hosting.CSharpObjectFormatter.FormatException(Exception e) at Microsoft.CodeAnalysis.Interactive.InteractiveHost.Service.DisplayException(Exception e) at Microsoft.CodeAnalysis.Interactive.InteractiveHost.Service.<>c__DisplayClass42_0.<<ExecuteOnUIThread>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Interactive.InteractiveHost.Service.<ExecuteOnUIThread>d__42.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Interactive.InteractiveHost.Service.<ExecuteAsync>d__30.MoveNext()
Pre-bind state information
LOG: DisplayName = System.ComponentModel.TypeConverter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/ManagedLanguages/VBCSharp/InteractiveComponents/
LOG: Initial PrivatePath = NULL Calling assembly : (Unknown).
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\ManagedLanguages\VBCSharp\InteractiveComponents\InteractiveHost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.ComponentModel.TypeConverter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
Requires targeting 16.4.
IRtfBuilderService2 is public in 16.4 (in Microsoft.VisualStudio.Text.UI package).
IWaitIndicator is obsolete by public Microsoft.VisualStudio.Utilities.IUIThreadOperationExecutor back in 15.6.
The editor now switches content type of a closed buffer to inert
. This is a breaking change. To switch to the previous behavior the Interactive Window needs to mark language buffers with DoNotSetContentTypeOnClose
property.
buffer.Properties.AddProperty("DoNotSetContentTypeOnClose", null);
This property is being added by https://devdiv.visualstudio.com/DevDiv/_git/VS-Platform/pullrequest/254269.
Is there a way to navigate to a namespace and start using db or other server functions without having to include every dependency?
The Clojure repl allows you to call (in-ns 'my-db-namespace) and then I can call my database setup function. All dependencies are include when you navigate to the namespace. Currently, it looks like I have to include all .dlls when I am in a c# namespace. Is this feature possible? However, the Clojure repl compiles the program first before the interactive dev environment starts.
Thanks
This issue has been moved from a ticket on Developer Community.
[severity:It bothers me. A fix would be nice]
Dear VS Developers,
In VS 2022 17.7.5 interal C# interactive, it seems like Korean language input is not handled properly.
Letters are duplicated and split up as screenshot. When I tried C# interactive in Developers PowerShell for VS 2022, letters were displayed correctly.
Searching this problem, I have found former feedbacks that reported similar problems as below. And it hasn't been actually resolved.
[https://developercommunity.visualstudio.com/t/Typing-korean-strings-in-C-interactive/1331438]
[https://developercommunity.visualstudio.com/t/The-input-of-Korean-languages-need-to-be/306143]
Thank you.
(private comment, text removed)
(private comment, text removed)
(private comment, text removed)
(private comment, text removed)
(no solutions)
Tracking TODO in .editorconfig.
Moved from dotnet/roslyn#63317
Version Used: VS 17.3 (Roslyn 4.3.0.3-22401.3)
Steps to Reproduce:
Expected Behavior: All error diagnostics are colored correctly (red).
Actual Behavior: The last 13 characters are colored black, while the rest is colored correctly.
This does not affect csi
in the console, which is always colored correctly.
Tracking TODO in .editorconfig.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.