digitalcourage.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Diese Instanz wird betrieben von Digitalcourage e.V. für die Allgemeinheit. Damit wir das nachhaltig tun können, erheben wir einen jährlichen Vorausbeitrag von 1€/Monat per SEPA-Lastschrifteinzug.

Server stats:

825
active users

#roslyn

0 posts0 participants0 posts today
Brad Wilson<p>Realizing that it's been more than a year since VS 2019 went out of mainstream support.</p><p>Is it time to remove support for it from the xUnit.net Analyzers yet?</p><p><a href="https://mastodon.social/tags/DotNet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DotNet</span></a> <a href="https://mastodon.social/tags/CSharp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CSharp</span></a> <a href="https://mastodon.social/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a> <a href="https://mastodon.social/tags/Analyzers" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Analyzers</span></a></p>
Mick Mertens<p><span class="h-card" translate="no"><a href="https://mastodon.art/@enriquericos" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>enriquericos</span></a></span> I recently bought the DVD-Box and can confirm it has lost none of its magic.<br>But be aware: it may lead to wishing for the good old days to return.<br>I am curious what you think after a rewatch.</p><p>Btw: doof you know that there is a Podcast out there? Look for Northern Overexposure - it’s quite nice <a href="https://mastodon.social/tags/cicely" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>cicely</span></a> <a href="https://mastodon.social/tags/kbhr" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>kbhr</span></a> <a href="https://mastodon.social/tags/chrisinthemorning" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>chrisinthemorning</span></a> <a href="https://mastodon.social/tags/roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>roslyn</span></a></p>
Brad Wilson<p>I love theories in <span class="h-card" translate="no"><a href="https://dotnet.social/@xunit" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>xunit</span></a></span>.</p><p>The <a href="https://mastodon.social/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a> analysis testing framework does not love theories.</p><p>The compilation step for running an analyzer/fixer test is so expensive that it encourages massive test collapse.</p><p>In one example, I went from testing 12 permutations to testing 36, and the time spent running them went down by 20%. Better coverage, faster, but the result is giant tests born of copy/paste.</p><p>Before: <a href="https://github.com/xunit/xunit.analyzers/blob/4d9048672a0ae0de6980b5f7e0f87ce560814dde/src/xunit.analyzers.tests/Analyzers/X1000/MemberDataShouldReferenceValidMemberTests.cs#L255-L401" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/xunit/xunit.analyze</span><span class="invisible">rs/blob/4d9048672a0ae0de6980b5f7e0f87ce560814dde/src/xunit.analyzers.tests/Analyzers/X1000/MemberDataShouldReferenceValidMemberTests.cs#L255-L401</span></a> </p><p>After: <a href="https://github.com/xunit/xunit.analyzers/blob/db66d95621a7a51a24e21b164bdf996554301e30/src/xunit.analyzers.tests/Analyzers/X1000/MemberDataShouldReferenceValidMemberTests.cs#L255-L432" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/xunit/xunit.analyze</span><span class="invisible">rs/blob/db66d95621a7a51a24e21b164bdf996554301e30/src/xunit.analyzers.tests/Analyzers/X1000/MemberDataShouldReferenceValidMemberTests.cs#L255-L432</span></a></p><p><a href="https://mastodon.social/tags/DotNet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DotNet</span></a> <a href="https://mastodon.social/tags/CSharp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CSharp</span></a> <a href="https://mastodon.social/tags/Analyzer" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Analyzer</span></a></p>
Kirill Osenkov<p><a href="https://source.dot.net" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">source.dot.net</span><span class="invisible"></span></a> now has the Roslyn source code as well, so the legacy <a href="https://sourceroslyn.io" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">sourceroslyn.io</span><span class="invisible"></span></a> is no longer required.</p><p>Somehow I missed that!</p><p><a href="https://mastodon.social/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a> <a href="https://mastodon.social/tags/roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>roslyn</span></a></p>
Brad Wilson<p>Getting a little annoyed by the fact that IDE analyzers in .NET 9 like IDE0301 and IDE0305 trigger and fix into code that won't compile (in particular, the compiler won't convert collection initializers into ImmutableArray&lt;T&gt; automatically).</p><p><a href="https://mastodon.social/tags/DotNet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DotNet</span></a> <a href="https://mastodon.social/tags/DotNet9" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DotNet9</span></a> <a href="https://mastodon.social/tags/CSharp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CSharp</span></a> <a href="https://mastodon.social/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a></p>
Kirill Osenkov<p>If anyone needs to bulk generate GlobalSuppressions.cs from Roslyn analyzers (on a potentially huge solution), I wrote a sample here:<br><a href="https://github.com/KirillOsenkov/CodeCleanupTools/blob/e6aa2eda6bdfc2f359a2254168fac73f9971e158/CodeFixer/Program.cs#L144-L233" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/KirillOsenkov/CodeC</span><span class="invisible">leanupTools/blob/e6aa2eda6bdfc2f359a2254168fac73f9971e158/CodeFixer/Program.cs#L144-L233</span></a></p><p>VS itself doesn't do a reliable job here, but this tool should scale much better. Also shows how Roslyn concepts work.</p><p><a href="https://mastodon.social/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a> <a href="https://mastodon.social/tags/roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>roslyn</span></a> <a href="https://mastodon.social/tags/analyzers" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>analyzers</span></a></p>
Kirill Osenkov<p>Just ran into the weirdest C# oddity, but apparently this is not only not a bug, but documented and specced behavior:<br><a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0507#example-2" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">learn.microsoft.com/en-us/dotn</span><span class="invisible">et/csharp/language-reference/compiler-messages/cs0507#example-2</span></a></p><p><a href="https://mastodon.social/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a> <a href="https://mastodon.social/tags/csharp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>csharp</span></a> <a href="https://mastodon.social/tags/roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>roslyn</span></a></p>
Kirill Osenkov<p>Roslyn Quoter on Wasm powered by Uno:<br><a href="https://roslynquoter-wasm.platform.uno" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">roslynquoter-wasm.platform.uno</span><span class="invisible"></span></a></p><p>Thanks to <span class="h-card" translate="no"><a href="https://mastodon.social/@jlaban" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>jlaban</span></a></span> for building and hosting the Uno version!</p><p><a href="https://mastodon.social/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a> <a href="https://mastodon.social/tags/roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>roslyn</span></a> <a href="https://mastodon.social/tags/uno" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>uno</span></a> <a href="https://mastodon.social/tags/wasm" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>wasm</span></a></p>
Brad Wilson<p>Any <a href="https://mastodon.social/tags/DotNet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DotNet</span></a> <a href="https://mastodon.social/tags/CSharp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CSharp</span></a> <a href="https://mastodon.social/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a> experts know what is the cheap/appropriate way to find assembly-level attributes when doing an analysis?</p><p>For <span class="h-card" translate="no"><a href="https://dotnet.social/@xunit" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>xunit</span></a></span> we've added some new assembly-level registrations via attribute that would impact whether source analyzers should trigger or not. In this case, we're currently use a mix of SymbolAction and SyntaxNodeAction.</p>
Kirill Osenkov<p>I prototyped a tool to apply a Roslyn Code Fix to a codebase:<br><a href="https://github.com/KirillOsenkov/CodeCleanupTools/tree/main/CodeFixer" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/KirillOsenkov/CodeC</span><span class="invisible">leanupTools/tree/main/CodeFixer</span></a></p><p>It should be much faster than dotnet format and can scale to very large codebases. It doesn't use the MSBuildWorkspace to read the entire .sln into memory, instead it reads the MSBuild binlog and processes one .csproj at a time. It doesn't even need an .sln, all it needs is for the codebase to have built with a binlog.</p><p><a href="https://mastodon.social/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a> <a href="https://mastodon.social/tags/roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>roslyn</span></a></p>
Mathias Hasselmann<p>It's not easy to impress me these days, but this is absolutely brilliant static code analysis.</p><p>Well done <a href="https://mastodon.green/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a> people!</p><p>The code in the first screenshot will throw an exception as `expectedUnsignedResponses` already contains "signature".</p><p>My naive fix to the problem is seen in the first screenshot.</p><p>The third shows how <a href="https://mastodon.green/tags/VSCod" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>VSCod</span></a> (rather <a href="https://mastodon.green/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a> I assume) proposes to fix the issue.</p>
Kirill Osenkov<p>How Roslyn syntax trees represent structured trivia:<br><a href="https://github.com/KirillOsenkov/Bliki/wiki/Roslyn-Structured-Trivia" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/KirillOsenkov/Bliki</span><span class="invisible">/wiki/Roslyn-Structured-Trivia</span></a></p><p>Wrote up from an internal explanation for posterity.</p><p><a href="https://mastodon.social/tags/roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>roslyn</span></a> <a href="https://mastodon.social/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a> <a href="https://mastodon.social/tags/csharp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>csharp</span></a> <a href="https://mastodon.social/tags/syntax" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>syntax</span></a> <a href="https://mastodon.social/tags/parser" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>parser</span></a></p>
Brad Wilson<p>"When the analyzer doesn't know your code is compiled against multiple target frameworks and with multiple compiler versions": This is the list of common analyzer rules I had to disable by hand because the analyzer didn't or couldn't see the entire compilation context (mostly because the code needs to target C# 6 and/or netstandard1.1)</p><p><a href="https://mastodon.social/tags/DotNet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DotNet</span></a> <a href="https://mastodon.social/tags/CSharp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CSharp</span></a> <a href="https://mastodon.social/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a></p>
Brad Wilson<p>The <a href="https://mastodon.social/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a> team was the first team at Microsoft (outside of CodePlex) to adopt xUnit.net. There were some design decisions that we made in v1 in order to support them.</p><p>Today our symbiotic relationship is as strong as ever: they continue to use us for unit tests, have written extensions to xUnit.net to make it easier to test Roslyn extensions (like analyzers and code generators), and with today's PR merge we have 83 Roslyn analyzers, many with fixers. 🎉</p>
Khalid K-1000 🤖<p>Can a <a href="https://mastodon.social/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a> analyzer modify a `csproj` file?</p>
Brad Wilson<p>Loving the discovery of `/* lang=c#-test */` for syntax coloring in strings. I wish it worked with interpolated strings, but I understand why it doesn't, so it makes me want to convert to `string.Format`; see the two examples. (The context here is the analyzer testing for <span class="h-card" translate="no"><a href="https://dotnet.social/@xunit" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>xunit</span></a></span>.)</p><p><a href="https://mastodon.social/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a> <a href="https://mastodon.social/tags/csharp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>csharp</span></a> <a href="https://mastodon.social/tags/roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>roslyn</span></a></p>
Gérald Barré<p>If you are writing tests for <a href="https://hachyderm.io/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a> analyzers or source generators, you can syntax highlight C# in strings by prefixing the string with /*lang=c#-test*/ or by using the StringSyntax attribute.<br><a href="https://www.meziantou.net/how-to-test-a-roslyn-analyzer.htm#get-syntax-highlight" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">meziantou.net/how-to-test-a-ro</span><span class="invisible">slyn-analyzer.htm#get-syntax-highlight</span></a></p>
Brad Wilson<p>Surprisingly, I found what I *think* is a bug in <a href="https://mastodon.social/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a> Nullable Reference Type support.</p><p>If you have a base interface:</p><p>interface IFoo {<br> object? SomeValue { get; }<br>}</p><p>and then another interface that overrides:</p><p>interface IBar: IFoo {<br> new object SomeValue { get; }<br>}</p><p>Removing the nullability there, even if what you have is an IBar, it assumes that SomeValue is still potentially null even though they're two different properties.</p><p><a href="https://mastodon.social/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a> <a href="https://mastodon.social/tags/csharp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>csharp</span></a></p>
Gérald Barré<p>How to test a Roslyn analyzer <a href="https://hachyderm.io/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a> <a href="https://hachyderm.io/tags/roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>roslyn</span></a> <a href="https://www.meziantou.net/how-to-test-a-roslyn-analyzer.htm?utm_medium=social&amp;utm_source=mastodon" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">meziantou.net/how-to-test-a-ro</span><span class="invisible">slyn-analyzer.htm?utm_medium=social&amp;utm_source=mastodon</span></a></p>
Brad Wilson<p>Anybody know when we get the <a href="https://mastodon.social/tags/Roslyn" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Roslyn</span></a> 4.10 NuGet packages (like Microsoft.CodeAnalysis)?</p><p>I'm assuming they're going to follow the "even" pattern and declare 17.10 as LTSC, which means I will want to officially support Roslyn 4.10. Both of these pages are currently out of date:</p><p><a href="https://learn.microsoft.com/en-us/visualstudio/productinfo/vs-servicing" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">learn.microsoft.com/en-us/visu</span><span class="invisible">alstudio/productinfo/vs-servicing</span></a></p><p><a href="https://learn.microsoft.com/en-us/visualstudio/extensibility/roslyn-version-support?view=vs-2022" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">learn.microsoft.com/en-us/visu</span><span class="invisible">alstudio/extensibility/roslyn-version-support?view=vs-2022</span></a></p><p><a href="https://mastodon.social/tags/dotnet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dotnet</span></a></p>