Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:33
    davidwengier synchronize #61427
  • 05:06
    tmat synchronize #61356
  • 03:58
    jcouv synchronize #61403
  • 00:09
    333fred milestoned #61444
  • 00:09
    333fred unlabeled #61444
  • 00:09
    dotnet-issue-labeler[bot] labeled #61444
  • 00:09
    dotnet-issue-labeler[bot] labeled #61444
  • 00:09
    333fred labeled #61444
  • 00:09
    333fred assigned #61444
  • 00:09
    333fred labeled #61444
  • 00:09
    333fred labeled #61444
  • 00:09
    333fred opened #61444
  • 00:03
    dotnet-bot closed #61443
  • 00:02
    dotnet-bot auto_merge_enabled #61443
  • 00:02
    dotnet-bot assigned #61443
  • 00:02
    dotnet-bot labeled #61443
  • 00:02
    dotnet-bot labeled #61443
  • 00:02
    dotnet-bot review_requested #61443
  • 00:02
    dotnet-bot review_requested #61443
  • 00:02
    dotnet-bot review_requested #61443
Ghost
@ghost~5e286e11d73408ce4fd779fa
You mean where they noticed that or where the issue was?
Joseph Musser
@jnm2
The issue.
I'm going to want to specify global usings in csproj for sure, to reduce turbulence in files, but I don't really have a good sense of the tradeoffs for what the defaults should be.
Ghost
@ghost~5e286e11d73408ce4fd779fa
Well, with SDK preview 7 and TFM net6, you get implicit global using files (opt-out exists, sure). But that SDK doesn't mean that LangVersion is at 10. So global usings aren't valid, so upgrading from net5 to net6 breaks the build, because there are implicit global usings which just fail to compile. Cool, so next step enabling LangVersion=preview, right? Sure, but now you're spammed with thousands of "duplicate using directive" warnings. Horrible. So eventually: opt-out of the nonsense.
Not to mention all the ways the preview SDK broke builds when TFM is net5 :-D
I thought I waited long enough and skipped enough previews to have a smooth transition. Guess I was still a bit too early to try out the new stuff
egilhansen
@egilhansen:matrix.org
[m]
that has some very useful methods for my usecase
egilhansen
@egilhansen:matrix.org
[m]
Do anybody have FluentAssertions roslyn extensions, e.g. syntaxtree.Should().ContainNamespace("Foo.Bar")
MartyIX
@MartyIX
Hi, is https://github.com/dotnet/roslyn-analyzers/ in some "release will be soon, do not merge new stuff" state?
I'm asking because I don't see merges and not so much reviewing is happening there too
Or should I ping a specific person to review dotnet/roslyn-analyzers#5374 ?
Bernd Baumanns
@bernd5
What is the recommended way to load csproj files?
I tried MSBuildWorkspace - but it seems not to work for me
Bernd Baumanns
@bernd5
it ignored nearly everything defined in the csproj file
Ah, the SDK file was not found
Bernd Baumanns
@bernd5
Are there some samples?
Bernd Baumanns
@bernd5
Bernd Baumanns
@bernd5
I looked at CSharpCompilationOptions.Usings
I thought it is to configure global using
But I don't understand:
Bernd Baumanns
@bernd5
I found:
global usings are only visible in script code
But how can we load a new net6.0 project with implicit usings?
Should we generate a CompilationUnit with those global usings?
Egil Hansen
@egilhansen:matrix.org
[m]

Hey people, just a sanity check before I waste more time... can I have a source generator create a class with a partial unimplemented method, and then have the user implement that method in a class they write manually?

Generation works, and the compiler complains afterword's that CS8795 Partial method 'MyClass.MyMethod(CancellationToken)' must have an implementation part because it has accessibility modifiers.

But when I in the user project create a class in the right namespace with the right name, the CS8795 error goes away but is replaced with a CS0759 No defining declaration found for implementing declaration of partial method 'MyClass.MeMethod(CancellationToken)'.

So that leads me to think that this approach is not possible?

Yair Halberstadt
@YairHalberstadt
It should work fine. Is that a VS error, or a compilation error?
I.e. does it work fine when you compile it.
Egil Hansen
@egilhansen:matrix.org
[m]
@YairHalberstadt it seems like a build time error
I am using c#10 and a rc1 nightly though
Egil Hansen
@egilhansen:matrix.org
[m]
Arrrg nevermind. Guess it was a chicken and eg thing. I had three partial method generated, and once I implemented all three all the errors went away.
well sort of, Visual Studio is still not happy and continue to report CS0759
Yair Halberstadt
@YairHalberstadt
Yeah visual studio tooling still isn't perfect with SGs.
You can report that as a roslyn bug and hopefully it'll get fixed some time.
egilhansen
@egilhansen:matrix.org
[m]
Yep, its the same with the blazor soruce generator. in gneral SGs are cool, but e.g. having the ability to delete generated files that are no longer relevant, e.g. because the user renamed or moved a file, is pretty high on the list of things to have.
Yair Halberstadt
@YairHalberstadt
I don't understand what that means? SGs generate a fresh set of files every compilation. You should never need to delete any.
egilhansen
@egilhansen:matrix.org
[m]
So e.g. i changed my analyzer to produce file1 instead of file_1, and the later was not removed, and was still picked up by the compiler.
If you rename a Blazor (.razor) file you sometimes have to restart vs to get things working again.
Yair Halberstadt
@YairHalberstadt
That sounds like a VS problem, not a roslyn problem. Should work fine from the compiler
Egil Hansen
@egilhansen:matrix.org
[m]
You might be right
Adam Speight
@AdamSpeight2008
Could Source Generators be used to generate the various Syntax Nodes and BoundNodes used by the compilers themself?
Eg Boot Strap build then nodes and then compile the rest of the selection.
CyrusNajmabadi
@CyrusNajmabadi
Source generators do that :)
That is how we generate the syntax nodes.
See CSharpSyntaxGenerator.
Adam Speight
@AdamSpeight2008
I meant using the language feature "Source Generators" to generate them, rather the "manually pre-source generators" way of generating source code.
CyrusNajmabadi
@CyrusNajmabadi
yes. that's what i'm saying
CSharpSyntaxGenerator uses the language feature 'Source Generators'