dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.02k stars 4.03k forks source link

Sprint 104 Summary #12974

Closed AnthonyDGreen closed 6 years ago

AnthonyDGreen commented 8 years ago

Visual Basic & C# Compiler Team Accomplishments

AdamSpeight2008 commented 8 years ago

Do like this, as it gives the community (well me at least) a sense of progress, Few minor notes: Needs a tag Sprint Summary, Possible spelling mistake Interactuve should be Interactive

AdamSpeight2008 commented 8 years ago

Plus we can make ourselves laugh at what the mind comes up, when filling the [Redacted]

Got the Russians and Chinese folks sign NDAs and we have a meeting set up for next week to discuss tactical nuclear strike on ISIS with them.

jmarolf commented 8 years ago

@AdamSpeight2008 fixed spelling and added a new label

iam3yal commented 8 years ago

Awesome! ;)

vbcodec commented 8 years ago

@AnthonyDGreen Thanks for summary. I have few questions regard VB:

Thanks in advance

CyrusNajmabadi commented 8 years ago

[redacted]. Trolllolololol

jmarolf commented 8 years ago

@vbcodec

VB Interactive

The Interactive Execution Team didn't work on it this sprint. As you can see they spent a lot of time working on [Redacted]

Support for tuples only by ValueTuple or also other types

@AnthonyDGreen may need to jump in if I am misunderstanding the question, but this should be support for ValueTuple as described here

Type switch will be added

I can only refer you to the language feature status page which is what we are trying to get done. Type switch for VB or C# hasn't been completed yet.

Xamarin and VB

Nothing to announce here right now. I'll let you know when we have something concrete to share. Don't want to commit to things until I can guarantee they are going to happen.

AnthonyDGreen commented 8 years ago

@vbcodec

VB Interactive

The VB Interactive window just isn't ready yet. I'm not sure what pieces of it are in the public repo but right now it requires a lot of work not just on the IntEx side but also on the compiler side (and probably IDE side) to make the submission chaining semantics work. When last I tested it Imports statements and variable declarations weren't working across multiple submissions. That's not the only work needed but fixing it will require compiler expertise and the compiler team has been pretty heads down on the first batch of language features for VB 15 (and C# 7).

Support for tuples only by ValueTuple or also other types

If you're asking whether the tuple expression syntax (3, 5) can be used to construct other types like System.Tuple or KeyValuePair, the plan as I recall is that the tuple expression isn't intrinsically of those types but may convert to those types. Is that your question?

Type switch will be added

TypeCase :) It will be but the idea we have now is that features can be released more often than we have in the past so we're not stressing too much about compromising the design to meet the RTM schedule. TypeCase can show up in a update and we're working on how to get you easy access to early previews.

You can see the implementation I've been testing in my fork here: https://github.com/AnthonyDGreen/roslyn/tree/features/vb-typecase

That's a very straightforward design/implementation. But one thing we've been very concerned with this release is that TypeCase shouldn't be a stand-alone feature but a special case of a larger feature called pattern matching. The hope was to have a broad pattern matching framework with the type pattern being the first to ship in VB 15 and more complex patterns showing up in previews and updates. The implementation of typecase there isn't a pattern matching implementation, it's a standalone implementation of Select Case on type. So a lot of the guts of the feature would need to change to generalize so we can rapidly prototype and add new patterns through the VB 15 "wave" as we call it. Feel free to clone the repo, pull down the source, build, and run the VisualStudioSetup project to deploy it to an experimental VS hive where you can use the feature and provide feedback. The IDE tooling and debugging and compiling should all be there even if the implementation is a bit short-sighted. Near term I want to make getting features outside of a full VS release or beta a lot easier than syncing and building sources so more people can party on a design before we ship it and it's too late to change.

Xamarin and VB

I've gotten this feedback a lot, over the internet, at conferences, and customer interviews. I've taken the feedback to heart and I'll let you know as soon as we have anything concrete to share.

BreyerW commented 8 years ago

What about nuples and womples? Are they still uncertain canditate for tuple featureset? I cant recall firm decision in past design notes

vbcodec commented 8 years ago

@AnthonyDGreen VB Interactive For now I use C# Interactive mainly as expression evaluator. In some cases I can just Copy + Paste from VB code to C# Interactive, but for others I must modify expression before executing. From VB Inetractive I just need expression evaluator, just like evaluating expression in "Watch X' window while debugging code. For start this will be enough, and may be expanded if users ask for more. Could be very useful to add debug mode fo C# / VB Inetractive, where called method can hit breakpoints. I have created similar solution by using T4 templates (*.tt files) that compile VB file to library and run method. Because T4 can be debugged, then compiled VB code is also debugged. Bit convoluted but works, and I can quickly test some function, without firing application and navigate to specific code.

Other types in tuples I mean section "Tuple syntax for other types" from #11031 Do such method is correct ?

Public Function GetCar () As (Name As String, Speed As Integer)
Return New Car ("XXX", 200)
End Function 

Type switch (TypeCase) Glad that it will be implemented. Would be nice to write:

IIf(TypeOf obj Is String s, s.Trim(), "non string")

AnthonyDGreen commented 8 years ago

@vbcodec

I think you meant "If(..." not "Iif". Iif is just a function and will evaluate both sides even if the condition is false where as the If operator short-circuits. I know we all used Iif for years before but we added in in 2008 for situations like that.

I don't think we're doing that this time around. But, if you define a type with a conversion operator from tuple that would work.

One thing that's still bothering me is the overlap between the Immediate Window, which does expression evaluation and the Interactive Window, which also does expression evaluation. Keep in mind, you don't have to be debugging to use the Immediate window. If you have a project open you can always type VB expressions and since VS2015 those expressions can include queries and lambda expressions. The Immediate Window is also seeded by default with the startup project context so you can even instantiate types and/or call into methods in your class libraries, hit breakpoints, debug them, EnC, etc. Now, obvious the Interactive window has much better tooling with full IntelliSense and syntax colorization and other niceties. It's waay easier to do multi-line/multi-statement input in the Interactive window. But it doesn't support debugging.

Ultimately we imagine there only being one window that maybe has different modes but we're nowhere near the point of merging the two. Could you tell me more about when you'd use Interactive vs when you'd use the Immediate window?

miloush commented 8 years ago

@AnthonyDGreen

If you have a project open you can always type VB expressions

Well that's not exactly true. The project needs to be compiling and it basically only works if the project is class library. It still works if it is a console application, although opening an extra console. However, if it is an Windows application, such as WPF, it opens the main window and never evaluates the expression. And if you close it, you end up blocking the Immediate window since the evaluation is still "in progress".

Because of that, I almost never use Immediate window at design time. On the other hand, as you said it gets the project context and you easily can work with the types you wrote, which is why I almost never use Interactive window at debug time. I use Immediate window to test or use the types I developed and the Interactive window to do expression evaluations, occasionally to run selected code from the project, although the tooling there is a bit lacking.

I quite got the idea that there is eventually going to be one window only, but I can't get over the arrow keys working differently. 😕

vbcodec commented 8 years ago

@AnthonyDGreen I have tested Immediate Window some time ago, and results was discouraging. It do not work for asp net apps, and do not support intelisense. Today I've tested it again, and it seems that intelisense actually works (for WinForms), but not just after opening project. There is need to enter into debug mode, exit debugging, and intelisesnse magically appears for design time. There is some flaw that should be fixed, and added support form asp net, then this tool will be more usable.

For Interactive could be great not only to add debug mode, but also do present returned expression's values in the same way as "Watch X" while debugging, where we can expand results into list or use visualizers.

paul1956 commented 8 years ago

@vbcodec can you tell me how to get the immediate window to display while NOT debugging? It is not in the View Menu. I have tried in VS Windows Forms and Class Library projects.

miloush commented 8 years ago

@paul1956 Debug > Windows > Immediate

paul1956 commented 8 years ago

Thanks I have been using visual studio since VS-97 and never saw it. Why isn't it under View/Other Windows like everything else?

While I'm complaining how about sorting or organizing the list.

iam3yal commented 8 years ago

@paul1956 Mostly because all the debug windows are under Debug and it was initially a debugging tool.

AnthonyDGreen commented 8 years ago

Where it shows up in the menu depends on whether you use the General Settings profile or the Visual Basic settings profile or something else.

@miloush, it probably should open a new Command-line window in a Console app so that Console commands work right. So, for instance, typing ? Console.ReadLine() in the Immediate Window will print out the result of typing input in this window. Console.WriteLine() calls output to that window. We would definitely like to make the tooling experience here better around IntelliSense and colorization.

It works fine for me for WinForms but I can repro the issue you're seeing in WPF. That's a bug. It shouldn't do that. Please file a bug on us to fix.

Could you say more about how the arrow key behavior is bothering you? How would you like the arrow keys to work in each window?

paul1956 commented 8 years ago

@AnthonyDGreen how do I check/change profiles. I only remember seeing the selection when I created my online account. I use VB, WinForms, ASP AND WPF applications and never change profiles.

miloush commented 8 years ago

@AnthonyDGreen Interesting point, should I expect Console.ReadLine() to open Console even in Windows applications? Re: keys, it's probably just years using Immediate Window, expecting up and down arrows to go through the history. That's of course incompatible with the ability to enter multi-line statements, so there is no other way out than get used to the Alt combinations, which unfortunately require two hands (or #5125?). Another, perhaps related feature that Interactive Window misses is the ability to start editing any of the previous lines. In Immediate Window, this transfers the line to the input and does the edit there. And it should have a global shurtcut!

Other than that, looks to me like when the Interactive Window gets the project context (and perhaps recognizes ?), they could be merged.

tmat commented 8 years ago

@miloush In Interactive Window you can hit Ctrl+Enter to append the text of previous submission to the current submission.

In general, please file any suggestions for improvements to Interactive Window as separate issues.

AnthonyDGreen commented 8 years ago

@paul1956 I don't know how you check which profile you're using but you can reset it at any time in Visual Studio under Tools > Import and Export Settings... > Reset settings and then selecting one of our predefined settings profiles.

vbcodec commented 8 years ago

https://github.com/dotnet/roslyn/blob/master/docs/features/deconstruction.md Is Dev15 Preview 4 available now ? Does it have tuples in VB ?

jmarolf commented 8 years ago

@vbcodec Dev15 Preview 4 has not been released yet. Whatever is in the https://github.com/dotnet/roslyn/tree/dev15-preview4-df branch will be in it.

vbcodec commented 8 years ago

@jmarolf I've downloaded dev15-preview4-df and installed all compiled VSIX , on both VS 2015 Community and VS 15 Preview 3. Tuples works only for C# on VS 15 Preview 3. I've added System.ValueTuples from nuget. Any options to fix it ?

AnthonyDGreen commented 8 years ago

@VSadov Vlad, where can @vbcodec get his hands on the VB tuples work to help with testing? Is it in master or dev15-preview4-df?

AdamSpeight2008 commented 8 years ago

@AnthonyDGreen Branch https://github.com/dotnet/roslyn/tree/features/vbTuples ?

VSadov commented 8 years ago

VB tuples are in master for two days now. They are not in preview-4

VSadov commented 8 years ago

Note that you need ValueTuple nuget in your project for tuples to light up. There are some NYI areas in VB tuples - like metadata round trip. Parsing and binding work though, so you can get a feel of the feature.

timgoodman commented 8 years ago

It's great to see these Sprint Summaries being shared, even if parts need to be [Redacted] :)

vbcodec commented 8 years ago

Finally I was able to compile and run master on VS 2015 Community, and tuples looks and works great. There should be option to exclude ItemX from Intelisense, if name is provided. Does deconstruction work in VB ?

But there is persisting problem with restoring (restore.cmd) packages on Win 10 Anniversary Update. Text from console:

C:\Users\test\Desktop\roslyn-master\roslyn-master>restore.cmd Downloading NuGet 3.5.0-beta2 File C:\Users\test\Desktop\roslyn-master\roslyn-master\build\scripts\download-nuget.ps1 cannot be loaded. The file C:\Users\test\Desktop\roslyn-master\roslyn-master\build\scripts\download-nuget.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.

Changing policy for powershell do not help

Pilchie commented 8 years ago

Tag @jaredpar about the powershell issue above.

jaredpar commented 8 years ago

Sigh, why is Powershell so hard to run. Let me take a look.

jaredpar commented 8 years ago

https://github.com/dotnet/roslyn/pull/13121