Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSBuild with target netfx48 temp files present fails with Missing Method. #7873

Open
Wraith2 opened this issue Aug 10, 2022 · 13 comments
Open
Labels
Breaking Change bug Documentation Issues about docs, including errors and areas we should extend (this repo and learn.microsoft.com) triaged

Comments

@Wraith2
Copy link

Wraith2 commented Aug 10, 2022

Issue Description

Using a roslyn CodeAnalysis project running on net48 attempting to load a project also targetting net48 will fail to load dependencies caused by a missing method Method not found: 'System.ReadOnlySpan`1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1<Char>)' if the target project has already been compiled and has bin/obj directories present.

Steps to Reproduce

CodeAnalysisApp2.zip
Repro is attached. To use

  1. unzip and open the CodeAnalysisApp2.sln file then run it. It should load the console app solution and correctly run through to the console readline without displaying any problems.
  2. open the ConsoleApp2.sln and compile or run it
  3. reopen the CodeAnalysisApp2.sln and run it again, you should get an error:
Using MSBuild at 'C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin' to load projects.
Loading solution '..\..\..\..\ConsoleApp2.sln'
Evaluate        0:00.2464048    ConsoleApp2.csproj
Msbuild failed when processing the file 'D:\Programming\csharp10\CodeAnalysisApp2\ConsoleApp2\ConsoleApp2.csproj' with message: Method not found: 'System.ReadOnlySpan`1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1<Char>)'.
Finished loading solution '..\..\..\..\ConsoleApp2.sln'

Versions & Configurations

Latest VS 17.3 update, this worked on 17.2.
MSBuild version 17.3.0+f67e3d35e for .NET Framework 17.3.0.37102

@Wraith2 Wraith2 added bug needs-triage Have yet to determine what bucket this goes in. labels Aug 10, 2022
@Forgind
Copy link
Member

Forgind commented Aug 18, 2022

This is definitely funky! I could reproduce this perfectly. I fully closed VS afterwards then reopened CodeAnalysisApp2.sln, and it failed again, despite having succeeded when I ran it the first time. I also tried just running CodeAnalysisApp2 twice, and it succeeded both times. To me, that means building ConsoleApp2.sln somehow corrupts some local file cache that affects CodeAnalysisApp2.sln, but I'm not sure yet what exactly.

@tmeschter
Copy link
Contributor

I've also seen this. I have VS 17.4.0 Preview 2.0 (specifically, main 32815.74) and the executable is using the Microsoft.Build.Locator package to try to load a project via ProjectCollection.LoadProject. Using the debugger I've verified that the process is picking up Microsoft.Build.dll from C:\Program Files\Microsoft Visual Studio\2022\main\MSBuild\Current\Bin\Microsoft.Build.dll which is what I would expect.

Note that it does not occur when Microsoft.Build.Locator loads MSBuild from a 17.1 Preview 4 build that I happened to have on my system. Note that I have a number of VS installs and it is not clear which one Microsoft.Build.Locator will load from. :-)

@Wraith2
Copy link
Author

Wraith2 commented Aug 19, 2022

As I noted in the original report it worked fine on 17.2 and broke on 17.3. I wrote the project one day and had it working, i updated vs when it closed and then the next day it started to fail. It was quite a surprise.

@rainersigwald
Copy link
Member

rainersigwald commented Aug 25, 2022

Thanks for the repro project, that plus another nice repo from a Microsoft-internal person really helped me understand what's going on here, which is this:

  1. Roslyn 4.2 has (transitive) dependencies on System.Memory 4.0.1.1 (from package version 4.5.4).
  2. MSBuild 17.2 has (transitive) dependencies on System.Memory 4.0.1.1 (from package version 4.5.4).
  3. MSBuild 17.3 has dependencies on System.Memory 4.0.1.2 (from package version 4.5.5).
  4. Since those versions differ, the strong names of the assemblies differ, so the .NET Framework is happy to load them side by side (this would be different on .NET 6).
  5. At runtime, Locator correctly hooks up its assembly resolve events.
  6. Then Roslyn stuff or the app itself call some method that causes System.Memory 4.0.1.1 to be loaded.
  7. Then MSBuild is called and resolved through Locator's event handlers.
  8. Then MSBuild tries to call System.Memory 4.0.1.2, which is located and loaded by Locator.
  9. Everything is great! The assemblies are side-by-side but don't try to interchange types so everything is happy.
  10. Then MSBuild tries to call this method:

internal static bool IsFileNameMatch(string path, string pattern)
{
// Use a span-based Path.GetFileName if it is available.
#if FEATURE_MSIOREDIST
return IsMatch(Microsoft.IO.Path.GetFileName(path.AsSpan()), pattern);
#elif NETSTANDARD2_0
return IsMatch(Path.GetFileName(path), pattern);
#else
return IsMatch(Path.GetFileName(path.AsSpan()), pattern);
#endif
}

which compiles down to this IL for our net472 target:

    IL_0000: ldarg.0
    IL_0001: call valuetype [System.Memory]System.ReadOnlySpan`1<char> [System.Memory]System.MemoryExtensions::AsSpan(string)
    IL_0006: call valuetype [System.Memory]System.ReadOnlySpan`1<char> [Microsoft.IO.Redist]Microsoft.IO.Path::GetFileName(valuetype [System.Memory]System.ReadOnlySpan`1<char>)
    IL_000b: ldarg.1
    IL_000c: call bool Microsoft.Build.Shared.FileMatcher::IsMatch(valuetype [System.Memory]System.ReadOnlySpan`1<char>, string)
    IL_0011: ret
  1. This throws System.MissingMethodException: 'Method not found: 'System.ReadOnlySpan`1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1<Char>)'.'
  2. But why? We have a System.Memory of both versions loaded!
  3. Microsoft.IO.Redist.dll depends on System.Memory 4.0.1.1 (it is unchanged but System.Memory has a new version)
  4. So its return type is really [System.Memory 4.0.1.1] System.ReadOnlySpan`1<char>, but the type we need in Microsoft.Build is a [System.Memory 4.0.1.2] System.ReadOnlySpan`1<char> (because that was the winning version in our build).
  5. That's a mismatch, so the MissingMethodException is thrown: no method found matching that (version of) that type in its signature.
  6. This doesn't fail in normal MSBuild.exe operation, because we have binding redirects in place that ensure that all System.Memory types are 4.0.1.2:

<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />

  1. In the client application, there is no such binding redirect, because it's compiled against the .2 versions of everything that don't need one.

Tactically, there are two fixes that can be applied:

  1. Update the application's reference to the System.Memory to version 4.5.5 and binding redirect to it
    a. This may require adding the reference explicitly; it was likely transitive before
    b. Updating MSBuild references to 17.3 will do this automatically since that package depends on 4.5.5.
    c. You probably don't need to do binding redirects manually because they should be automatic
  2. Remove System.Memory.dll from the application directory
    a. This causes Locator to find the System.Memory that lives in MSBuild, which will be the correct version for MSBuild.
    b. If that version is the only version that can be loaded, the .NET Framework (essentially) binding-redirects all references to that version, so everything sees 4.0.1.2 and is consistent
    c. This can be nontrivial since it's coming to the app's output folder as a transitive reference.
    d. This also requires that MSBuildLocator be called before using any System.Memory types, which is stricter than was required before.

@Epic-Santiago
Copy link

I have tested and confirmed that doing a reverse bindingRedirect that forces the newer (4.5.5) version of System.Memory to an older version (4.5.4) resolves this issue. Obviously this is a workaround and not a proper solution but it may help someone else.

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.1" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

@Wraith2
Copy link
Author

Wraith2 commented Aug 31, 2022

I've also confirmed that adding a direct reference to the 4.5.5 version of System.Memory resolves the issue.
Do you want me to leave this open issue to track a fix rather than the workarounds given?

@rainersigwald
Copy link
Member

Let's leave it open for now to see if it's possible to fix in the MSBuild layer--but right now I don't think it is.

@Epic-Santiago
Copy link

I've also confirmed that adding a direct reference to the 4.5.5 version of System.Memory resolves the issue.

Explicitly adding a System.Memory PackageReference was needed because the transitive dependency was broken. This was fixed in Microsoft.Build 17.3 and it's a cleaner fix to upgrade that package than to add the explicit System.Memory reference.

@benvillalobos benvillalobos removed the needs-triage Have yet to determine what bucket this goes in. label Sep 1, 2022
@Wraith2
Copy link
Author

Wraith2 commented Sep 1, 2022

How do I get that version of Microsoft.Build? it's not a dependency of the project and I'm on the latest stable visual studio release which still has the problem unless I add the direct dependency.

@rainersigwald
Copy link
Member

If you use MSBuildWorkspace, it's a transitive reference of that so you can either get a new version with a direct reference to Microsoft.Build 17.3.1 or add a direct reference to System.Memory 4.5.5. If you don't have a direct reference to MSBuild I'd just do System.Memory, personally.

kzu added a commit to devlooped/nugetizer that referenced this issue Sep 3, 2022
The root cause analysis was performed in dotnet/msbuild#7873.

By upgrading to latest MSBuild 17.3.1, the issue is resolved.
kzu added a commit to devlooped/nugetizer that referenced this issue Sep 3, 2022
The root cause analysis was performed in dotnet/msbuild#7873.

By upgrading to latest MSBuild 17.3.1, the issue is resolved.
AArnott added a commit to dotnet/Nerdbank.GitVersioning that referenced this issue Sep 5, 2022
This is a workaround suggested in dotnet/msbuild#7873
AArnott added a commit to dotnet/Nerdbank.GitVersioning that referenced this issue Sep 5, 2022
This is a workaround suggested in dotnet/msbuild#7873
AArnott added a commit to dotnet/Nerdbank.GitVersioning that referenced this issue Sep 5, 2022
This is a workaround suggested in dotnet/msbuild#7873
@AArnott
Copy link
Contributor

AArnott commented Sep 5, 2022

This just broke the tests running locally and in Azure Pipelines for Nerdbank.GitVersioning. :(
https://dev.azure.com/andrewarnott/OSS/_build/results?buildId=6954&view=logs&j=0bc77094-9fcd-5c38-f6e4-27d2ae131589&t=206655b7-7ebc-5b58-0ce4-544602a53fe7

Adding the reference to System.Memory to my test project resolved the problem for me. Upgrading my MSBuild reference wasn't going to work out because my test project targets net461.

@zivkan
Copy link
Member

zivkan commented Oct 21, 2022

FYI, this is affecting nuget.exe as well.

We had to skip a bunch of our tests that no longer work: NuGet/NuGet.Client#4768
And we now have a customer telling us it's impacting them: NuGet/Home#12165

@Forgind
Copy link
Member

Forgind commented Oct 21, 2022

Were either of rainersigwald's mitigations helpful:
#7873 (comment)
?

GrahamTheCoder added a commit to icsharpcode/CodeConverter that referenced this issue Dec 18, 2022
Note: Needed to upgrade >3.11 to avoid dotnet/msbuild#7873
Needed to downgrade < 4.3 to avoid dotnet/roslyn#63780
GrahamTheCoder added a commit to icsharpcode/CodeConverter that referenced this issue Dec 19, 2022
Needed codeanalysis >3.11 to avoid dotnet/msbuild#7873
Needed codeanalysis< 4.3 to avoid dotnet/roslyn#63780

There may have been other workarounds
GrahamTheCoder added a commit to icsharpcode/CodeConverter that referenced this issue Dec 19, 2022
Needed codeanalysis >3.11 to avoid dotnet/msbuild#7873
Needed codeanalysis< 4.3 to avoid dotnet/roslyn#63780
GrahamTheCoder added a commit to icsharpcode/CodeConverter that referenced this issue Dec 19, 2022
Needed codeanalysis >3.11 to avoid dotnet/msbuild#7873
Needed codeanalysis< 4.3 to avoid dotnet/roslyn#63780
GrahamTheCoder added a commit to icsharpcode/CodeConverter that referenced this issue Dec 19, 2022
GrahamTheCoder added a commit to icsharpcode/CodeConverter that referenced this issue Dec 19, 2022
Needed codeanalysis >3.11 to avoid dotnet/msbuild#7873
Needed codeanalysis< 4.3 to avoid dotnet/roslyn#63780
GrahamTheCoder added a commit to icsharpcode/CodeConverter that referenced this issue Dec 19, 2022
Needed codeanalysis >3.11 to avoid dotnet/msbuild#7873
Needed codeanalysis< 4.3 to avoid dotnet/roslyn#63780
BrianFreemanAtlanta added a commit to BrianFreemanAtlanta/CodeConverter that referenced this issue Feb 28, 2024
* 9.0.3

* Do not run default code from UI against real converter to save on execution costs

* Apply timeout to simplification

* 9.0.4

* Bump node-forge from 0.10.0 to 1.3.1 in /Web/ClientApp

Bumps [node-forge](https://github.com/digitalbazaar/forge) from 0.10.0 to 1.3.1.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](digitalbazaar/forge@0.10.0...v1.3.1)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump json-schema from 0.3.0 to 0.4.0 in /Web/ClientApp

Bumps [json-schema](https://github.com/kriszyp/json-schema) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/kriszyp/json-schema/releases)
- [Commits](kriszyp/json-schema@v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: json-schema
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update CHANGELOG.md

* VB -> CS: Continue the correct of several continuable nested blocks - fixes icsharpcode#946

* Dedupe multiple exit/continue variables

* VB -> CS: Declare inline variable when referencing anonymously in VB - fixes icsharpcode#949

* At least avoid NRE in icsharpcode#948

Doesn't actually fix orderby and select of group though

* Update vb2cs_bug_report.md

* Update cs2vb_bug_report.md

* Update bug_report.md

* Bump loader-utils from 1.4.0 to 1.4.1 in /Web/ClientApp

Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.1/CHANGELOG.md)
- [Commits](webpack/loader-utils@v1.4.0...v1.4.1)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump minimatch and recursive-readdir in /Web/ClientApp

Bumps [minimatch](https://github.com/isaacs/minimatch) and [recursive-readdir](https://github.com/jergason/recursive-readdir). These dependencies needed to be updated together.

Updates `minimatch` from 3.0.4 to 3.1.2
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](isaacs/minimatch@v3.0.4...v3.1.2)

Updates `recursive-readdir` from 2.2.2 to 2.2.3
- [Release notes](https://github.com/jergason/recursive-readdir/releases)
- [Changelog](https://github.com/jergason/recursive-readdir/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jergason/recursive-readdir/commits/v2.2.3)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
- dependency-name: recursive-readdir
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump System.Data.SqlClient from 4.8.3 to 4.8.5 in /CommandLine/CodeConv

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.3 to 4.8.5.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump System.Data.SqlClient in /CommandLine/CodeConv.NetFramework

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.1 to 4.8.5.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump System.Data.SqlClient from 4.8.2 to 4.8.5 in /Func

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.2 to 4.8.5.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump System.Data.SqlClient from 4.8.1 to 4.8.5 in /Vsix

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.1 to 4.8.5.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump System.Data.SqlClient from 4.8.1 to 4.8.5 in /Web

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.1 to 4.8.5.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump loader-utils from 1.4.1 to 1.4.2 in /Web/ClientApp

Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](webpack/loader-utils@v1.4.1...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update README.md

* Remove global json and see what happens

* Temporarily disable these tests until they work with dot net 7

* Wait for build to finish!

* Update README.md

* Change build order in advance of using this in tests

* Don't use InitializeComponent in temp file

* Ignore temp files with InitializeComponent

* Splits static and instance handlers and include property ones icsharpcode#967

* Recommend VS2022

We'll likely need to drop VS2019 support to dodge the bugs caused by various combinations of the libraries

* Update README.md

* Try running exe

* nuget update all

* Use IsKind as required in later versions of codeanalysis

* Satisfy new API requirements

* Downgrade to 4.2.0 to avoid bugs in 4.3 and 4.4

Note: Needed to upgrade >3.11 to avoid dotnet/msbuild#7873
Needed to downgrade < 4.3 to avoid dotnet/roslyn#63780

* Revert attempt to run command line, even though it'd likely now work

* Update expectations (sane indentation) for what the new library does

* Ditch global.json again

* Try to pick a consistent set of dependencies based on the codeanalysis 4.2.0

* Ensure full error details appear in exception (not just log)

* Record version used

* Output version when available

* Block versions before 17.2 which will fail to load after this PR

* 9.1.0

* Undo VS2019 incompatible changes

* Update non-user-facing nuget packages

* Manually install System.Memory to get assembly version 4.1.2 and workaround dotnet/msbuild#7873

* Update CHANGELOG.md

* Update README.md

* Multiline strings correctly followed by a newline - fixes icsharpcode#970

* 9.1.1 (9.1.0 was never released)

* Update CHANGELOG.md

* Update README.md

* Remove converter error from icsharpcode#965 (still creates compile error) - closes icsharpcode#965

* Add test for icsharpcode#975 - closes icsharpcode#975

* Add to changelog

* Err on the side of caution for array types - fixes icsharpcode#962

* Remove todo that appears to be done

* Bump json5 from 1.0.1 to 1.0.2 in /Web/ClientApp

Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](json5/json5@v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Handle the case when the event container doesn't exist - relates to icsharpcode#977 icsharpcode#979

* Revert unintended change

* 9.1.2

* Sketch of solution for icsharpcode#982

* Add tests to refine details

* Rearrange methods

&& and || are special for not being applicable to nullable objects hence their special handling to get the value

* More tests

* Changelog

* Replace newline with specified character - fixes icsharpcode#973

* Fix test case compilation error - fixes icsharpcode#985

* Test tweaks

* 9.1.3

* Remove crash preventer which ironically now causes crashes - fixes icsharpcode#986

* Convert more targets matching common pattern

Existing MultiFileSolutionAndProjectTests cover this, the regex is generalised to work for other things like UWP projects
icsharpcode#988

* Add ToString when concatenating a string and an object - fixes icsharpcode#974

* Fixup other tests to use ToString

* Denied

CSC : error CS1617: Invalid option '11.0' for /langversion. Use '/langversion:?' to list supported values. [D:\a\CodeConverter\CodeConverter\CodeConverter\CodeConverter.csproj]

Build FAILED.

CSC : error CS1617: Invalid option '11.0' for /langversion. Use '/langversion:?' to list supported values. [D:\a\CodeConverter\CodeConverter\CodeConverter\CodeConverter.csproj]
    0 Warning(s)
    1 Error(s)

* Enable arm64 vsix

* Bump webpack from 5.65.0 to 5.76.1 in /Web/ClientApp

Bumps [webpack](https://github.com/webpack/webpack) from 5.65.0 to 5.76.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.65.0...v5.76.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* 9.2.0 - first arm64 compatible

* CType(Nothing, Date?) now converts to default(DateTime?) - fixes icsharpcode#994

* Conditional indexer now converted - fixes icsharpcode#993

* 9.2.1

* Fix issue icsharpcode#998

* Fix issue icsharpcode#1000

* Update CHANGELOG.md

* Fix issue icsharpcode#1003

* Update CHANGELOG.md

* Replace self too

* Set some fallback logic for picking name

* Allow object initializer to be self referential - fixes icsharpcode#1002

* Use different example

* Show where the comments end up

* Make progress each recursion - fixes icsharpcode#1007

* 9.2.2

* Pass through statements

* Move try/catch logic all to the same spot - and reuse method body visitor

* Generate a horrible do loop with a switch statement for handlers

TODO:
* Deal with non-returning code paths
* Ensure loops within the method can still break/continue as expected

* Handle one very specific case

* Handle nulls and remove comment from old plan

* Separate method

* Neaten up when there's no fall through

* Add to changelog

* Implement icsharpcode#1008 - could be spruced up with eg code samples, currently only taken the Description -> respective PackageReadme.md

* Update actions versions

* Specifically use 1.0.6 action that is using node 16

* If written or inherited, a property is generated which will do the hookup upon assignment

* Push event assignment to end of constructor - fixes icsharpcode#967

* Passing test - closes icsharpcode#991

* Changelog and test tweak

* Prevent source mapping for field initializers hoisted to constructor - fixes icsharpcode#1017

* Refine IsDefinitelyStatic

* Somewhat ugly mechanism for detecting when within an expression tree

* When converting "Is" and "IsNot" within an expression tree, use "==" - fixes icsharpcode#1015

* Mark WhereClauseSyntax as always boolean in CSharp - fixes icsharpcode#894

* Worked around "CONVERSION ERROR: usingKeyword" bug caused by VS 17.7.0 preview 2 - fixes icsharpcode#1019

Note the added test hasn't been seen to fail since updating the nuget package to the preview caused another issue I'll look into

* Don't use patterns when name is reusable - relates to icsharpcode#1011

* Try to precisely cover each case that requires a single execution

* Latest langversion

* Make it possible to track whether in query

* Don't bother trying to deal with nullables within expressions - closes icsharpcode#1011

* Changelog

* Update characterization

* Dodge null

* 9.2.3

* Bump tough-cookie from 4.0.0 to 4.1.3 in /Web/ClientApp

Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.0.0 to 4.1.3.
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](salesforce/tough-cookie@v4.0.0...v4.1.3)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add Linq.Expressions reference to defaults

* Restore original state rather than forcing false

* Pay attention to lambda expressions - fixes icsharpcode#930

Inspired by https://github.com/JosefPihrt/Roslynator/blob/7ba2f29f5090aa13f4dd6b7936af55180b678333/src/CSharp/CSharp/Extensions/SyntaxExtensions.cs#L3114

* Don't do VB comparison within expressions - fixes icsharpcode#316

* Maintain expression type in variable declaration

* Changelog

* Update README.md

* Omit ByVal as recommended by IDE0081 - fixes icsharpcode#1024

* Bump word-wrap from 1.2.3 to 1.2.4 in /Web/ClientApp

Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](jonschlinkert/word-wrap@1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* add test for a non-VB-Chr Method

* Fix VB.Chr method recognition

* remove trailing NewLine in SpecialConversionTests.cs

* remove EOL

* remove EOL

* really fix the EOL at EOF this time I hope

* Basic implementation with current library version - fixes 1032

* Use verbatim literals rather than manually escape

* Refine logic for using verbatim strings

* Update CHANGELOG.md

* tests: add tests for clashing renamer and enum types

* fix: clashing renamer for enums

* chore: update changelog

* refactor: use INamedTypeSymbol

* tests: regenerate results

* Bump @babel/traverse from 7.16.7 to 7.23.2 in /Web/ClientApp

Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.16.7 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* BinaryConditional's first expression isn't always boolean - fixes icsharpcode#1038

* Walk existing structure bottom up to avoid stack overflow - fixes icsharpcode#1033

Only worth doing this since it's a really easy way to cause an error that's been seen by multiple real users. Not planning to protect against every possible version of this, since that would add a lot of complexity for a tiny reward

* Bump axios from 0.27.2 to 1.6.0 in /Web/ClientApp

Bumps [axios](https://github.com/axios/axios) from 0.27.2 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v0.27.2...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Mention Versions

* This couldn't be resolved when running latest version of VS... don't know why

* Try to create this as a net standard project since msbuild is complaining about net 48 stuff

* Recharacterize in this form

* add a workaround

It's only required until dotnet/roslyn#71115 is fixed.

(cherry picked from commit b0a64e6)

* And the sln files

* Exit Property now returns value assigned to return variable - fixes icsharpcode#1051

* Remove square brackets when escaping labels and identifiers - fixes icsharpcode#1043, fixes icsharpcode#1044

* Add example

* Split test class in two

* It's a csharp compile error to use optional parameters before ref parameters - fixes icsharpcode#1057

* `Nothing` is the default, don't bother specifying since we can't get it right for structs - fixes icsharpcode#1056

* Avoid stack overflow in stack overflow prevention code - fixes icsharpcode#1047

* Reformat

* Apply to additional declarations - fixes icsharpcode#1053

Note: Also removed other changelog item which was broken and fixed within this release

* 9.2.4

* Remove missed issue

* Use a wrapper that calls escape identifier

* Overescape identifiers - fixes # 1043

Don't worry about exactly which context, just escape in any case

* This can obviously have dots in, so is a name, and it turns out we don't need to parse it

* Cast to dynamic when the accessed member can't be found but the surrounding object can - fixes icsharpcode#786

There's probably a more specific condition which should trigger this if we look in Roslyn code

* Conversion of parenthesized ref arguments no longer assigns back - fixes icsharpcode#1046

* Add Func + Web startup option

* Update to dot net 8 and react 18 render method

* Set the path in the url needed to debug locally

* Add new test and move existing tests together

The existing test may need an update to work for icsharpcode#749 and icsharpcode#1062

* Remove part of fix for icsharpcode#749 - fixes icsharpcode#1062

* Some more tests

* CHANGELOG

* Recharacterize

* Convert constant characters directly to constant strings

* Select case for a mixture of strings and characters converts correctly - fixes icsharpcode#1061

* Bump follow-redirects from 1.15.3 to 1.15.4 in /Web/ClientApp

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.3 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.3...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump System.Data.SqlClient from 4.8.5 to 4.8.6 in /Web

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump System.Data.SqlClient in /CommandLine/CodeConv.NetFramework

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump System.Data.SqlClient from 4.8.5 to 4.8.6 in /Func

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump System.Data.SqlClient from 4.8.5 to 4.8.6 in /Vsix

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump System.Data.SqlClient from 4.8.5 to 4.8.6 in /CommandLine/CodeConv

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Only cast for boxing when it's not implicit - fixes icsharpcode#1071

But since this removes some casts, do still ensure that predefined cast expressions always cast since otherwise casting to T via object gets broken

* 9.2.5

* Set TFM to net6.0;net8.0 for "warning NETSDK1138: The target framework 'netcoreapp3.1' is out of support and will not receive security updates in the future."

* Upgrade Azure Function to .NET 8

* Update NuGet packages for Tests project (based on File/New xUnit project)

* Update CHANGELOG.md

* Test for case similar to icsharpcode#782

* Don't try to ref foreach, Me or Using identifiers - fixes icsharpcode#1052

* Catch when it's a different type or the method is missing due to version issues

* Cater net 45 and non-compiling solutions

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: GrahamTheCoder <GrahamTheCoder@gmail.com>
Co-authored-by: Christoph Wille <christoph.wille@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: GrahamTheCoder <graham.helliwell@savanta.com>
Co-authored-by: Jeremy Philippe <jeremy.philippe@gmail.com>
Co-authored-by: Timur Kelman <tymur.gubayev@gmail.com>
Co-authored-by: Timur Kelman <Timur.Kelman@fecher.eu>
Co-authored-by: Dominik Baran <dominik.baran@gustline.com>
Co-authored-by: Dominik Baran <dominik.baran7@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change bug Documentation Issues about docs, including errors and areas we should extend (this repo and learn.microsoft.com) triaged
Projects
None yet
Development

No branches or pull requests

9 participants