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

Retarget everything to .NET 6 #606

Closed
wants to merge 2 commits into from
Closed

Retarget everything to .NET 6 #606

wants to merge 2 commits into from

Conversation

Numpsy
Copy link
Contributor

@Numpsy Numpsy commented Nov 2, 2023

An attempt at updating everything to .NET 6 all at once:

  • Use the .NET 6 SDK
  • Update Paket to v7
  • Update FAKE to v6
  • Update the .NET Test SDK to 17.7.2 (the latest version at the point the change was made)

Note: I had to fight with Paket a bit doing the updates as it kept trying to update Microsoft.Build.* to v17.7 (which needs .NET 7, and thus doesn't work) - so I hope the updated paket files are sensible

@Numpsy
Copy link
Contributor Author

Numpsy commented Nov 2, 2023

Extra note: this is a superset of the previous PRs

@backerman
Copy link

Works on my machine, but .github/workflows/publish.yml will need to be changed as well.

@knocte
Copy link
Collaborator

knocte commented Nov 21, 2023

@Numpsy hey, thanks for rebasing this PR. Sorry for being a bit unresponsive the past days, I was on holidays. Seems CI is broken now, can you fix?

@Numpsy
Copy link
Contributor Author

Numpsy commented Nov 21, 2023

It looks like the nuget package restore is failing on the macOS build (which then causes the Linux build that has got further to be aborted), not sure why that is.
There has been a new release of Paket as well, so I'll see if that's useful

@Numpsy
Copy link
Contributor Author

Numpsy commented Nov 21, 2023

Saying that, just forced a retry on the build at https://github.com/Numpsy/FSharpLint/actions/runs/6942714944 and it worked, so :-(

@Numpsy
Copy link
Contributor Author

Numpsy commented Nov 21, 2023

The error looks like the one described at fsprojects/Paket#3767
(I'm not sure what the 'storage: symlink' setting in the docs section of paket.dependencies is doing offhand though)

@knocte
Copy link
Collaborator

knocte commented Nov 21, 2023

Upgrading paket to v8 doesn't increase reliability?

@Numpsy
Copy link
Contributor Author

Numpsy commented Nov 21, 2023

I'll give it a go

@Numpsy
Copy link
Contributor Author

Numpsy commented Nov 21, 2023

It still seems to have a problem with Paket 8, but I did try a run without the storage:symlink setting for the docs at https://github.com/Numpsy/FSharpLint/actions/runs/6948076650 and that one worked

@knocte
Copy link
Collaborator

knocte commented Nov 22, 2023

I did try a run without the storage:symlink setting for the docs at https://github.com/Numpsy/FSharpLint/actions/runs/6948076650 and that one worked

So let's propose this as a separate PR to increase paket reliability on MacOS CI?

@Numpsy
Copy link
Contributor Author

Numpsy commented Nov 22, 2023

Ok.
Such a change might relate to #578 on Windows as well

knocte pushed a commit that referenced this pull request Nov 22, 2023
I've been trying to get everything [building with .NET 6](#606) and the related tooling, and have been getting CI build failures in the macOS builds, with errors that look like those described at fsprojects/Paket#3767

It looks like changing Paket to use 'packages' storage instead of 'symlink' avoids that issue, by putting the restored nuget packages directly into the local packages folder instead of symlinking them. (I don't know much about this Paket feature - the docs suggest its for reducing disk usage by avoid duplicates, which might not really be an issue for the builds?)

On a related note, we also have this issue - #578 - where you have to either run the build as admin on windows or set some extra OS options otherwise the package restore will fail. I think this change would avoid that as well.

Note: Changing the paket storage to 'none' helped with package restore issue, but caused the 'docs' build to break for me because the Fornax tool couldn't find the libraries, whereas it works when set to 'packages'
@knocte
Copy link
Collaborator

knocte commented Nov 22, 2023

Let's rebase this now?

@knocte
Copy link
Collaborator

knocte commented Nov 23, 2023

Let's now remove the Paket update? Since it's not really needed for this PR anymore.

@knocte
Copy link
Collaborator

knocte commented Dec 4, 2023

Let's now remove the Paket update? Since it's not really needed for this PR anymore.

@Numpsy ?

@Numpsy
Copy link
Contributor Author

Numpsy commented Dec 4, 2023

Let's now remove the Paket update? Since it's not really needed for this PR anymore.

@Numpsy ?

I removed the test change to use Paket 8, but the update to 7 was there because the version it currently uses doesn't understand .NET 6/7 and it caused build warnings when updating nuget packages that target those versions

@Numpsy
Copy link
Contributor Author

Numpsy commented Dec 4, 2023

rebased to resolve conflicts with other CI build definition changes

@knocte
Copy link
Collaborator

knocte commented Dec 5, 2023

rebased to resolve conflicts with other CI build definition changes

Thanks very much! BTW, do you mind if we make the commits a bit clear? For example:

  1. Update the sdk version in the publish workflow
  2. Build everything as .NET 6
  3. update build.yml

Can you squash 1 with 3 since they both change CI?

@knocte
Copy link
Collaborator

knocte commented Dec 6, 2023

If you don't know how can you merge 2 commits into 1 let me know and I'll be able to help. BTW, now that you'd be doing an interactive rebase, can you also explain (in the commit msg) the paket commands you ran that made changes into the paket.deps and paket.lock files? I'm not a paket expert so every little bit of extra info you could add would be appreciated.

@smoothdeveloper
Copy link
Contributor

@knocte, on the paket side, I'd guess the changes were "adjust paket.dependencies in text editor" (for the framework restrictions, often times, you can also do with no such restriction, a bit more verbose paket.lock file, but more resilient if you need to try or target different runtimes, without redoing install), followed by paket install in this case.

Sometimes, when I want to be conservative, I use paket install --keep-patch, it updates paket.lock based on my changes in paket.dependencies but it keeps the current dependencies as is.

Other times, when I want to see what a "updating everything" does, I just erase a group in the paket.lock and run the paket install --keep-patch again (so it doesn't change the other groups).

Other time, when I want to update just one dependency, I remove the line form the paket.lock an run paket install --keep-patch.

There are more fine grained commands for handling a specific dependency.

@Numpsy
Copy link
Contributor Author

Numpsy commented Dec 6, 2023

Can you squash 1 with 3 since they both change CI?

Ok, I'll do that later (and look at rebasing on top of the 0.21.5 changes at the same time)

@Numpsy
Copy link
Contributor Author

Numpsy commented Dec 6, 2023

@knocte, on the paket side, I'd guess the changes were "adjust paket.dependencies in text editor" (for the framework restrictions, often times, you can also do with no such restriction, a bit more verbose paket.lock file, but more resilient if you need to try or target different runtimes, without redoing install), followed by paket install in this case.

Sometimes, when I want to be conservative, I use paket install --keep-patch, it updates paket.lock based on my changes in paket.dependencies but it keeps the current dependencies as is.

Other times, when I want to see what a "updating everything" does, I just erase a group in the paket.lock and run the paket install --keep-patch again (so it doesn't change the other groups).

Other time, when I want to update just one dependency, I remove the line form the paket.lock an run paket install --keep-patch.

There are more fine grained commands for handling a specific dependency.

I think that's just what I did for updating the TFMs in paket.dependencies, followed by updates to the FAKE libs and the Test SDK (I don't think there were any updates to the versions of things beyond that).

My knowledge of Paket is very slim itself - as I mentioned on the initial post the attempt at updating without any extra settings tried to update things like Microsoft.Build that I didn't want it to (or which don't work), so it needs --keep-patch or similar to restrict what gets updated

@Numpsy Numpsy mentioned this pull request Dec 6, 2023
@knocte
Copy link
Collaborator

knocte commented Dec 7, 2023

I think that's just what I did for updating the TFMs in paket.dependencies

Can you be more specific please, and actually put the info in the commit msg. I want to be able to replicate what you did and see the same diff that your commit has.

BTW I'm afraid this needs yet another rebase (as I'm doing many releases in the past days which include merging stuff here and there that touches these files as well, sorry).

@Numpsy
Copy link
Contributor Author

Numpsy commented Dec 8, 2023

Rebased and updated commit comments.

For the record here, the paket install does need --keep-patch, otherwise running it now tries to update dependencies to the latest available (which are now in some cases the .NET 8 versions), which wasn't wanted for this PR.

@knocte
Copy link
Collaborator

knocte commented Dec 8, 2023

Thanks Richard! getting there. Now only 2 things left I think:

  • I see you also updated paket but you didn't mention why or explained how you did it (manually or also with a command?).
  • I generally prefer to merge PRs that have more than one commit with a merge-commit (instead of squashing or rebasing), but if this is the case I prefer to make sure that all CI statues of each of the commits is green (and in the particular case of this PR I have the feeling that some intermediate commits might not). Can you push 1 by 1 to make sure? There's two ways to do this, manually or automatically.

@Numpsy
Copy link
Contributor Author

Numpsy commented Dec 11, 2023

The paket tool was just updated with dotnet tool update paket, and doing things one change at once was what

#603
#605

were trying to do (this one contains both of those, but #603 could still be completed separately)

@knocte
Copy link
Collaborator

knocte commented Dec 12, 2023

The approach of merging this work as separate PRs is different than merging a PR with separate commits. I don't prefer the former because each PR needs to have its own goal. However, a PR can have a goal but still be split in different commits with specific sub-goals which, all combined achieve the bigger goal of the PR. And in the latter approach, I prefer that each commit has a green CI status.

I've been trying to replicate what you did, with the instructions you provided, in my own branch here (not succeeding yet, so far): https://github.com/knocte/FSharpLint/commits/make_it_all_6/ I will now take your advice about how to update paket (because that's the only difference, I guess, between my branch and yours), and report further.

@Numpsy
Copy link
Contributor Author

Numpsy commented Dec 14, 2023

I had to rebase everything on top of the changes in #629, and that has also meant that all the changes to the build yaml file are now in one commit.

Also added an extra 'Update paket with dotnet tool update paket' to the commit message.

@knocte
Copy link
Collaborator

knocte commented Dec 15, 2023

that all the changes to the build yaml file are now in one commit.

Ah, that makes more sense! However, to double-check that everything is good now with the commits of your PR, I pushed them one by one, cherry-picking them into a branch of mine, and I'm afraid their intermediate CI statuses are not green. See:

https://github.com/knocte/FSharpLint/commits/rw/make_it_all_6/

This means that there are some bits of the commits that depend on each other. To try to make myself understood I'm going to bring a naive example: you're correcting the README.md file in your last commit but that means the README.md file was broken in the commit that changed the name of the workflow; therefore, the changes for that commit should be squashed with the commit that changes the name of the workflow (the one titled "update the CI builds").

The above is just an example because when I say that the "README.md file is broken", what I mean is that it links to a broken link for a CI badge. It's not easy to see/know that it's broken. But CI sometimes can gives us better hints of how something is broken.

@knocte
Copy link
Collaborator

knocte commented Dec 19, 2023

@Numpsy thanks for rebasing again! We're getting closer because now there's only 1 red CI status, see my branch (which is exactly the same as yours, but pushed 1 by 1):

https://github.com/knocte/FSharpLint/commits/rw/make_it_all_6/

Shouldn't you just squash the last commit with the previous one, to solve the problem?

Another thing to be improved that I find in your commit msg is:

Update paket with dotnet tool update paket, to get a version with .net 6 support

However, if I do the same on my machine, it updates to version 8.0.0, not 7.2.1 like it happened in your PR. Did you forget to append --version flag?

@knocte
Copy link
Collaborator

knocte commented Dec 20, 2023

On another note, I keep trying to replicate what you did, without success:

https://github.com/knocte/FSharpLint/commits/updToNet6/

I'm not sure how you fixed the CI issues. And if I can't figure out from the info in your commit msgs, then we need better commit messages. @MrLuje ping? maybe you can help here move this forward?

@Numpsy
Copy link
Contributor Author

Numpsy commented Dec 20, 2023

Did you forget to append --version flag?

No, it's just that the initial PR was done before .NET 8 went RTM, so doing it without specifying an explicit version got 7.x at the time, and might get 8 now.

As the only code (rather than build/project) changes were already merged in #636 we could probably just squash the CI and project changes, yes.

 Update fake-cli with dotnet tool update fake-cli to update to the .NET 6 version
 Update paket with dotnet tool update paket, to get a version with .net 6 support
 Update Paket restrictions by editing paket.dependencies and changing frameworks to net6.0
 Run dotnet paket install --keep-patch to update paket.lock
 Run dotnet paket update --group build to update FAKE to v6
 Update the CI build
@knocte
Copy link
Collaborator

knocte commented Dec 24, 2023

As the only code (rather than build/project) changes were already merged in #636 we could probably just squash the CI and project changes, yes.

Agreed.

No, it's just that the initial PR was done before .NET 8 went RTM, so doing it without specifying an explicit version got 7.x at the time, and might get 8 now.

Got it. However, I tried to replicate again what you did, this time adding the --version flag when updating paket (to upgrade to the same version you upgraded to) and I still got CI broken. What magic trick did you do in your diff (that you're forgetting to add to the commit message) to make CI pass?

This is the branch where I followed your instructions from your commit msg bit by bit:

https://github.com/knocte/FSharpLint/commits/replicateNumpsyWork/

And this is the error that CI gets:

Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/system.text.encodings.web/8.0.0/lib/net8.0/System.Text.Encodings.Web.xml', please tell the package authors
Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/system.security.cryptography.protecteddata/8.0.0/lib/net8.0/System.Security.Cryptography.ProtectedData.xml', please tell the package authors
Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/microsoft.net.stringtools/17.8.3/lib/net8.0/Microsoft.NET.StringTools.pdb', please tell the package authors
Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/system.text.encoding.codepages/8.0.0/lib/net8.0/System.Text.Encoding.CodePages.dll', please tell the package authors
Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/system.security.cryptography.pkcs/8.0.0/lib/net8.0/System.Security.Cryptography.Pkcs.xml', please tell the package authors
Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/system.formats.asn1/8.0.0/lib/net8.0/System.Formats.Asn1.dll', please tell the package authors
Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/system.configuration.configurationmanager/8.0.0/lib/net8.0/System.Configuration.ConfigurationManager.xml', please tell the package authors
Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/system.collections.immutable/8.0.0/lib/net8.0/System.Collections.Immutable.dll', please tell the package authors
Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/microsoft.build.utilities.core/17.8.3/lib/net8.0/Microsoft.Build.Utilities.Core.xml', please tell the package authors
Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/microsoft.build.framework/17.8.3/lib/net8.0/Microsoft.Build.Framework.dll', please tell the package authors
Could not detect any platforms from 'net8.0' in '/home/runner/.nuget/packages/system.text.json/8.0.0/lib/net8.0/System.Text.Json.dll', please tell the package authors
6.0.417

Is it maybe that you're forgetting to comment about 2 modifications you did in paket.dependencies? In particular, assigning "strategy" to "min" and/or changing framework: netstandard2.0 to net6.0? You're not commenting anything about that in your commit msg and I doubt that any tool you invoked made those changes.

knocte added a commit to knocte/FSharpLint that referenced this pull request Dec 26, 2023
There seems to be no way to fix this problem with the tests throwing the
below exception about not finding ConfigurationManager assembly (unless
we modify the paket.lock file **manually** like we do in this commit):

```
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
  Failed FunctionalTestConsoleApplication [651 ms]
  Error Message:
     Did not find the following expected errors: [`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.,`List.head (List.sort x)` might be able to be refactored into `List.min x`.,`a <> true` might be able to be refactored into `not a`.,`fun x -> x` might be able to be refactored into `id`.,`not (a <> b)` might be able to be refactored into `a = b`.,`not (a = b)` might be able to be refactored into `a <> b`.,`not false` might be able to be refactored into `true`.,`not true` might be able to be refactored into `false`.,`x = null` might be able to be refactored into `isNull x`.]
Found the following unexpected warnings: []
Complete output: MSBuild could not load the project file /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.NetCore/FSharpLint.FunctionalTest.TestedProject.NetCore.fsproj because: InvalidProjectFileMessage
  "GenericError
  ("/home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.NetCore/FSharpLint.FunctionalTest.TestedProject.NetCore.fsproj",
   "Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)")"

  Expected and actual are both <Microsoft.FSharp.Collections.FSharpSet`1[System.String]>
  Values differ at index [0]
  Missing:  < "`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.", ... >
  Stack Trace:
     at FSharpLint.FunctionalTest.Tests.TestConsoleApplication.FunctionalTestConsoleApplication() in /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/TestConsoleApplication.fs:line 108

  Failed FunctionalTestConsoleApplicationSolution [649 ms]
  Error Message:
     Did not find the following expected errors: [`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.,`List.head (List.sort x)` might be able to be refactored into `List.min x`.,`a <> true` might be able to be refactored into `not a`.,`fun x -> x` might be able to be refactored into `id`.,`not (a <> b)` might be able to be refactored into `a = b`.,`not (a = b)` might be able to be refactored into `a <> b`.,`not false` might be able to be refactored into `true`.,`not true` might be able to be refactored into `false`.,`x = null` might be able to be refactored into `isNull x`.]
Found the following unexpected warnings: []
Complete output: MSBuild could not load the project file /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.MultiTarget/FSharpLint.FunctionalTest.TestedProject.MultiTarget.fsproj because: InvalidProjectFileMessage
  "GenericError
  ("/home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.MultiTarget/FSharpLint.FunctionalTest.TestedProject.MultiTarget.fsproj",
   "Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)")"

  Expected and actual are both <Microsoft.FSharp.Collections.FSharpSet`1[System.String]>
  Values differ at index [0]
  Missing:  < "`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.", ... >
  Stack Trace:
     at FSharpLint.FunctionalTest.Tests.TestConsoleApplication.FunctionalTestConsoleApplicationSolution() in /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/TestConsoleApplication.fs:line 124

Failed!  - Failed:     2, Passed:     8, Skipped:     0, Total:    10, Duration: 7 s - /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/bin/Release/net6.0/FSharpLint.FunctionalTest.dll (net6.0)
```

And the idea was actually extracted from PR#606 [1] diff.

[1] fsprojects#606

Co-authored-by: webwarrior <reg@webwarrior.ws>
@Numpsy
Copy link
Contributor Author

Numpsy commented Dec 28, 2023

The changes to the .net version in paket.dependencies were what the 'editing paket.dependencies and changing frameworks to net6.0' comment in the commit is about (In the case of the Build group, I think because the fake 5 libraries were built as .net standard 2, and the fake 6 libraries are built as .net 6.0).

Did you use the --keep-patch flag when doing the paket install? That's supposed to stop it trying to update the libraries to newer versions.
(I wonder if some of this would work better if more of the entries in paket.dependencies had version contraints applied - e.g. should the Microsoft.Build.* references have a maximum version of 17.3.x so that it won't try to update to versions that require .NET 7 or 8? That's a separate change though)

knocte added a commit to knocte/FSharpLint that referenced this pull request Dec 28, 2023
There seems to be no way to fix this problem with the tests throwing the
below exception about not finding ConfigurationManager assembly (unless
we modify the paket.lock file **manually** like we do in this commit):

```
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
  Failed FunctionalTestConsoleApplication [651 ms]
  Error Message:
     Did not find the following expected errors: [`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.,`List.head (List.sort x)` might be able to be refactored into `List.min x`.,`a <> true` might be able to be refactored into `not a`.,`fun x -> x` might be able to be refactored into `id`.,`not (a <> b)` might be able to be refactored into `a = b`.,`not (a = b)` might be able to be refactored into `a <> b`.,`not false` might be able to be refactored into `true`.,`not true` might be able to be refactored into `false`.,`x = null` might be able to be refactored into `isNull x`.]
Found the following unexpected warnings: []
Complete output: MSBuild could not load the project file /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.NetCore/FSharpLint.FunctionalTest.TestedProject.NetCore.fsproj because: InvalidProjectFileMessage
  "GenericError
  ("/home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.NetCore/FSharpLint.FunctionalTest.TestedProject.NetCore.fsproj",
   "Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)")"

  Expected and actual are both <Microsoft.FSharp.Collections.FSharpSet`1[System.String]>
  Values differ at index [0]
  Missing:  < "`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.", ... >
  Stack Trace:
     at FSharpLint.FunctionalTest.Tests.TestConsoleApplication.FunctionalTestConsoleApplication() in /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/TestConsoleApplication.fs:line 108

  Failed FunctionalTestConsoleApplicationSolution [649 ms]
  Error Message:
     Did not find the following expected errors: [`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.,`List.head (List.sort x)` might be able to be refactored into `List.min x`.,`a <> true` might be able to be refactored into `not a`.,`fun x -> x` might be able to be refactored into `id`.,`not (a <> b)` might be able to be refactored into `a = b`.,`not (a = b)` might be able to be refactored into `a <> b`.,`not false` might be able to be refactored into `true`.,`not true` might be able to be refactored into `false`.,`x = null` might be able to be refactored into `isNull x`.]
Found the following unexpected warnings: []
Complete output: MSBuild could not load the project file /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.MultiTarget/FSharpLint.FunctionalTest.TestedProject.MultiTarget.fsproj because: InvalidProjectFileMessage
  "GenericError
  ("/home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.MultiTarget/FSharpLint.FunctionalTest.TestedProject.MultiTarget.fsproj",
   "Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)")"

  Expected and actual are both <Microsoft.FSharp.Collections.FSharpSet`1[System.String]>
  Values differ at index [0]
  Missing:  < "`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.", ... >
  Stack Trace:
     at FSharpLint.FunctionalTest.Tests.TestConsoleApplication.FunctionalTestConsoleApplicationSolution() in /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/TestConsoleApplication.fs:line 124

Failed!  - Failed:     2, Passed:     8, Skipped:     0, Total:    10, Duration: 7 s - /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/bin/Release/net6.0/FSharpLint.FunctionalTest.dll (net6.0)
```

And the idea was actually extracted from PR#606 [1] diff.

[1] fsprojects#606

Co-authored-by: webwarrior <reg@webwarrior.ws>
knocte pushed a commit to knocte/FSharpLint that referenced this pull request Dec 28, 2023
There seems to be no way to fix this problem with the tests throwing the
below exception about not finding ConfigurationManager assembly (unless
we modify the paket.lock file **manually** like we do in this commit):

```
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
  Failed FunctionalTestConsoleApplication [651 ms]
  Error Message:
     Did not find the following expected errors: [`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.,`List.head (List.sort x)` might be able to be refactored into `List.min x`.,`a <> true` might be able to be refactored into `not a`.,`fun x -> x` might be able to be refactored into `id`.,`not (a <> b)` might be able to be refactored into `a = b`.,`not (a = b)` might be able to be refactored into `a <> b`.,`not false` might be able to be refactored into `true`.,`not true` might be able to be refactored into `false`.,`x = null` might be able to be refactored into `isNull x`.]
Found the following unexpected warnings: []
Complete output: MSBuild could not load the project file /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.NetCore/FSharpLint.FunctionalTest.TestedProject.NetCore.fsproj because: InvalidProjectFileMessage
  "GenericError
  ("/home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.NetCore/FSharpLint.FunctionalTest.TestedProject.NetCore.fsproj",
   "Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)")"

  Expected and actual are both <Microsoft.FSharp.Collections.FSharpSet`1[System.String]>
  Values differ at index [0]
  Missing:  < "`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.", ... >
  Stack Trace:
     at FSharpLint.FunctionalTest.Tests.TestConsoleApplication.FunctionalTestConsoleApplication() in /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/TestConsoleApplication.fs:line 108

  Failed FunctionalTestConsoleApplicationSolution [649 ms]
  Error Message:
     Did not find the following expected errors: [`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.,`List.head (List.sort x)` might be able to be refactored into `List.min x`.,`a <> true` might be able to be refactored into `not a`.,`fun x -> x` might be able to be refactored into `id`.,`not (a <> b)` might be able to be refactored into `a = b`.,`not (a = b)` might be able to be refactored into `a <> b`.,`not false` might be able to be refactored into `true`.,`not true` might be able to be refactored into `false`.,`x = null` might be able to be refactored into `isNull x`.]
Found the following unexpected warnings: []
Complete output: MSBuild could not load the project file /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.MultiTarget/FSharpLint.FunctionalTest.TestedProject.MultiTarget.fsproj because: InvalidProjectFileMessage
  "GenericError
  ("/home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest.TestedProject/FSharpLint.FunctionalTest.TestedProject.MultiTarget/FSharpLint.FunctionalTest.TestedProject.MultiTarget.fsproj",
   "Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)")"

  Expected and actual are both <Microsoft.FSharp.Collections.FSharpSet`1[System.String]>
  Values differ at index [0]
  Missing:  < "`List.fold ( + ) 0 x` might be able to be refactored into `List.sum x`.", ... >
  Stack Trace:
     at FSharpLint.FunctionalTest.Tests.TestConsoleApplication.FunctionalTestConsoleApplicationSolution() in /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/TestConsoleApplication.fs:line 124

Failed!  - Failed:     2, Passed:     8, Skipped:     0, Total:    10, Duration: 7 s - /home/runner/work/FSharpLint/FSharpLint/tests/FSharpLint.FunctionalTest/bin/Release/net6.0/FSharpLint.FunctionalTest.dll (net6.0)
```

And the idea was actually extracted from PR#606 [1] diff, so we
add him as co-author.

[1] fsprojects#606

Co-authored-by: Richard Webb <webby@beardmouse.co.uk>
@knocte
Copy link
Collaborator

knocte commented Dec 28, 2023

'editing paket.dependencies and changing frameworks to net6.0' comment in the commit is about

You're still not explaining what the min: addition change is about.

Did you use the --keep-patch flag when doing the paket install?

Yes I did, since @smoothdeveloper explained it above (very useful thanks Gauthier).

I wonder if some of this would work better if more of the entries in paket.dependencies had version contraints applied - e.g.

That might be the right way to do it indeed (and maybe this is what you did, since CI in your branch is green), but if you haven't documented it I cannot really accept a PR that changes paket.lock so much without me being able to replicate it (that paket.lock file is a blackbox...).

So in the end I've succeeded in, more or less, adopting the work you did here, in this other PR: #655 , which I'm going to merge shortly. Thanks for your work! I added a co-authored git tag to it.

@knocte knocte closed this in #655 Dec 28, 2023
knocte added a commit that referenced this pull request Dec 28, 2023
.NET5 is out of support, and .NET6 is an LTS version.

Closes #606

Co-authored-by: Richard Webb <webby@beardmouse.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants