Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 07:35
    Daxode edited #61504
  • 07:35
    Daxode edited #61504
  • 07:27
    Daxode edited #61504
  • 07:26
    dotnet-issue-labeler[bot] labeled #61504
  • 07:26
    dotnet-issue-labeler[bot] labeled #61504
  • 07:26
    Daxode opened #61504
  • 07:15
    msftbot[bot] milestoned #60808
  • 07:15
    mavasani closed #60808
  • 05:52
    mavasani auto_merge_enabled #60808
  • 05:52
    mavasani synchronize #60808
  • 05:50
    jcouv review_requested #61341
  • 05:50
    jcouv ready_for_review #61341
  • 05:50

    jcouv on main

    Lifted relational operator impl… (compare)

  • 05:50
    msftbot[bot] milestoned #61403
  • 05:50
    jcouv closed #61403
  • 05:50
    jcouv closed #61361
  • 04:54
    cston edited #59194
  • 04:40
    cston synchronize #61389
  • 04:20
    mavasani commented #61420
  • 04:17
    mavasani commented #61420
Joe4evr
@Joe4evr
probably waiting for .NETConf, yea
Bernd Baumanns
@bernd5
you can download the preview versions
But I assume the final versions will be published soon
Ryan
@ryan:chat.binarydad.com
[m]
Was anyone else having issues searching for files in any of the 2022 previews?
I would type in solution Explorer and it would never find any files
Bernd Baumanns
@bernd5
here it works
Ryan
@ryan:chat.binarydad.com
[m]
hmm...never did for me. i can ctrl+F just fine, but searching in the right under solution explorer never shows anything
ok... disregard. updated to RTM for 2022 and it seems to work...
Vyacheslav Avdeev
@lsoft
dotnet6 is here, but what's about incremental generators docs? did I miss it? the existings doc ( https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md ) is obsolete even in terms of classes names...
Joe4evr
@Joe4evr
how is it that I get build errors that are not pushed to the Error List?
image.png
CyrusNajmabadi
@CyrusNajmabadi
Sounds like a bug. Please report it
Mohammad Hamdy Ghanem
@VBAndCs
untitled12.jpg
Remove unused local function? This is too scary!
Bernd Baumanns
@bernd5
what is scary?
Paul M Cohen
@paul1956
For VB functions that are Event Handlers appear as unused and VS 2022 removes handles clauses sometimes so the function would be deleted.
CyrusNajmabadi
@CyrusNajmabadi
That's a bug if so. Please file.
Jon Evans
@glitch100

Morning all.

Is it still the case that debugging Roslyn Analyzers/ CodeFixProviders can only be done via the VSIX Extension project? Is it possible to debug a unit test that is written? As in step into the Analyzer code?

Joe4evr
@Joe4evr
I've always used a unit test to step into analyzer code
never heard of a VSIX project being "the only way" to debug an analyzer
Jon Evans
@glitch100
Do you use a specific helper method to invoke your Analyzer code?
Jon Evans
@glitch100
My goodness
Antony Male
@canton7
I took that and modified it a bunch, ended up with something quite nice
Joe4evr
@Joe4evr
and it needs to be told which assembly to load the analyzers from + possible dependencies, so there's room for improvement
Jon Evans
@glitch100
Checking them atm - cheers all
HaloFour
@HaloFour
Mohammad Hamdy Ghanem
@VBAndCs
I am using this extension method in c#:
    public static IEnumerator GetEnumerator(this System.ValueTuple<int, int, int> range)
    {
        int start = range.Item1;
        int end = range.Item2;
        int step = range.Item3;

        if (step > 0)
            for (int i = start; i <= end; i += step)
                yield return i;
        else
            for (int i = start; i >= end; i += step)
                yield return i;
    }
It allows me to use this code:
foreach (int i in (-10, 10, 3))
    Console.WriteLine(i);
I imported this method from C# to VB and I can also use it in for each:
image.png
Mohammad Hamdy Ghanem
@VBAndCs
image.png
But, this doesn't work:
    Sub Main(args As String())
        For Each i In (1, 10, 2).GetEnumerator()
            Console.WriteLine(i)
        Next
The starnge thing is that the opposite happens if I define the extensoin method in vb code!
Imports System.Runtime.CompilerServices

Public Module Tools
    <Extension>
    Public Iterator Function GetEnumerator(range As ValueTuple(Of Integer, Integer, Integer)) As IEnumerable
        Dim start = range.Item1
        Dim [end] = range.Item2
        Dim [step] = range.Item3

        If ([step] > 0) Then
            For i = start To [end] Step [step]
                Yield i
            Next
        Else
            For i = start To [end] Step [step]
                Yield i
            Next
        End If
    End Function

End Module
In this case, the (1, 10, 2).GetEnumerator()expression works, but (1, 10, 2) doesn't!
Why?
image.png
Mohammad Hamdy Ghanem
@VBAndCs
image.png
Yair Halberstadt
@YairHalberstadt
@VBAndCs because extension GetEnumerator is c# only
It's a C# 9.0 feature (which I implemented) and I never implemented it for VB.
Mohammad Hamdy Ghanem
@VBAndCs
This answers why it doesn't work when it is written in VB. But it works for vb when I reference it from C#. I am asking why?
And why .GetEnumerator works if it's written in vb and doesn't work in C#?
Is it ok to write a GetEnumerator function but can't call it directly?
Antony Male
@canton7
(Note that since your extension methods return the non-generic IEnumerable, you'll be boxing an int on every iteration of the loop, which is a fair chunk of unneeded garbage)
Mohammad Hamdy Ghanem
@VBAndCs
Thanks. I wasn't sure that IEnumerable<int> works and left it to try later, since I am just exploring new possibilities.
Yair Halberstadt
@YairHalberstadt
@VBAndCs what matters is which language the foreach is in, not which language has the GetEnumerator
It's a change to the spec for how foreach binds. There's nothing special about the GetEnumerator method. Just C# recognizes certain patterns when lowering foreach and VB a different set.
Antony Male
@canton7
My understanding of the question was that VB did manage to use an extension GetEnumerator, but only when the extension GetEnumerator was written in C#, not in VB?