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

Upgrade backend to .NET 5 #1198

Merged
merged 15 commits into from
Jun 25, 2021
Merged

Upgrade backend to .NET 5 #1198

merged 15 commits into from
Jun 25, 2021

Conversation

johnthagen
Copy link
Collaborator

@johnthagen johnthagen commented Jun 18, 2021

Closes #1200
Closes #1149


This change is Reviewable

@johnthagen johnthagen added backend maintenance Issue that makes it difficult to maintain the software or to upgrade installations post-release. labels Jun 18, 2021
@johnthagen johnthagen self-assigned this Jun 18, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jun 18, 2021

Codecov Report

Merging #1198 (39193f0) into master (041ecb7) will decrease coverage by 0.01%.
The diff coverage is 22.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1198      +/-   ##
==========================================
- Coverage   44.73%   44.71%   -0.02%     
==========================================
  Files         266      266              
  Lines        8068     8077       +9     
  Branches      528      528              
==========================================
+ Hits         3609     3612       +3     
- Misses       4043     4049       +6     
  Partials      416      416              
Flag Coverage Δ
backend 57.29% <29.72%> (-0.06%) ⬇️
frontend 33.45% <5.88%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Backend/Controllers/InviteController.cs 0.00% <0.00%> (ø)
Backend/Controllers/UserController.cs 37.50% <0.00%> (-1.04%) ⬇️
Backend/Repositories/ProjectRepository.cs 0.00% <0.00%> (ø)
Backend/Repositories/UserRepository.cs 0.00% <0.00%> (ø)
Backend/Startup.cs 0.00% <0.00%> (ø)
src/api/api/invite-api.ts 6.38% <0.00%> (ø)
src/api/api/merge-api.ts 4.22% <0.00%> (ø)
src/api/api/user-api.ts 11.11% <0.00%> (ø)
src/api/api/user-edit-api.ts 2.38% <0.00%> (ø)
src/api/api/user-role-api.ts 2.40% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 041ecb7...39193f0. Read the comment docs.

@johnthagen johnthagen changed the title Disable configuring unused Razor pages Migrate away from deprecated Newtonsoft JSON serializer Jun 18, 2021
@johnthagen

This comment has been minimized.

@johnthagen johnthagen marked this pull request as ready for review June 18, 2021 17:38
@johnthagen
Copy link
Collaborator Author

.NET 5 has an improved JSON Serializer: #1200

This would allow us to avoid some limitations with the current serializer:

System.NotSupportedException: Deserialization of reference types without parameterless constructor is not supported. Type 'BackendFramework.Models.UserEditStepWrapper'

@johnthagen johnthagen marked this pull request as draft June 18, 2021 17:57
Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 10 of 13 files at r3.
Reviewable status: 10 of 13 files reviewed, all discussions resolved (waiting on @imnasnainaec)


docs/user_guide/docs/licenses/backend_licenses.txt, line 92 at r3 (raw file):

Version:2.1.0

Hmm, this is confusing a couple of ways.

  1. Just above we are including the license for version 2.2.0 Given my experience with .Net assembly references we almost certainly aren't using both.
  2. I guess the package versions here don't actually match the asp.net version? So these new ones presumably appeared from the use of System.Text.Json.Serialization?

@johnthagen
Copy link
Collaborator Author


docs/user_guide/docs/licenses/backend_licenses.txt, line 92 at r3 (raw file):

Previously, jasonleenaylor (Jason Naylor) wrote…
Version:2.1.0

Hmm, this is confusing a couple of ways.

  1. Just above we are including the license for version 2.2.0 Given my experience with .Net assembly references we almost certainly aren't using both.
  2. I guess the package versions here don't actually match the asp.net version? So these new ones presumably appeared from the use of System.Text.Json.Serialization?

We're including --include-transitive in the dotnet-project-licenses command, so that might have something to do with it? Due to how the dependencies are described in C# packages, it might be difficult for a license checker looking from the side to know how the final linking happens. Perhaps that is why there is duplication?

@johnthagen johnthagen changed the title Migrate away from deprecated Newtonsoft JSON serializer Upgrade backend to .NET 5 Jun 18, 2021
@johnthagen johnthagen marked this pull request as ready for review June 18, 2021 18:51
@jasonleenaylor
Copy link
Contributor


Backend/Controllers/UserController.cs, line 41 at r5 (raw file):

[ProducesResponseType(StatusCodes.Status200OK)]
``

Do we need to add 404 here now?

Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 16 files at r4.
Reviewable status: 14 of 27 files reviewed, all discussions resolved (waiting on @imnasnainaec and @jasonleenaylor)


docs/user_guide/docs/licenses/backend_licenses.txt, line 92 at r3 (raw file):

Previously, johnthagen wrote…

We're including --include-transitive in the dotnet-project-licenses command, so that might have something to do with it? Due to how the dependencies are described in C# packages, it might be difficult for a license checker looking from the side to know how the final linking happens. Perhaps that is why there is duplication?

Perhaps, and the change to 5.0 didn't really change this. 🤷‍♂️

@johnthagen
Copy link
Collaborator Author


Backend/Controllers/UserController.cs, line 41 at r5 (raw file):

Previously, jasonleenaylor (Jason Naylor) wrote…
[ProducesResponseType(StatusCodes.Status200OK)]
``

Do we need to add 404 here now?

Per discussions with @imnasnainaec documenting non-200 responses is of pretty low value because it doesn't change the generated type script code. It ends up being a bunch of bookkeeping without any real value.

@imnasnainaec Please correct me if I'm mischaracterizing our conclusion about this.

@johnthagen
Copy link
Collaborator Author

Some LGTM logs:

[2021-06-18 18:55:19] [build-stdout]   /usr/lib/mono/msbuild/Current/bin/NuGet.targets(128,5): error : Package SIL.Core.Desktop 8.0.0 is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Package SIL.Core.Desktop 8.0.0 supports: net461 (.NETFramework,Version=v4.6.1) [/opt/src/BackendFramework.sln]
[2021-06-18 18:55:19] [build-stdout]   /usr/lib/mono/msbuild/Current/bin/NuGet.targets(128,5): error : Package SIL.DictionaryServices 8.0.0 is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Package SIL.DictionaryServices 8.0.0 supports: net461 (.NETFramework,Version=v4.6.1) [/opt/src/BackendFramework.sln]
[2021-06-18 18:55:19] [build-stdout]   /usr/lib/mono/msbuild/Current/bin/NuGet.targets(128,5): error : Package SIL.Lift 8.0.0 is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Package SIL.Lift 8.0.0 supports: net461 (.NETFramework,Version=v4.6.1) [/opt/src/BackendFramework.sln]
[2021-06-18 18:55:19] [build-stdout]   /usr/lib/mono/msbuild/Current/bin/NuGet.targets(128,5): error : Package SIL.Core.Desktop 8.0.0 is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Package SIL.Core.Desktop 8.0.0 supports: net461 (.NETFramework,Version=v4.6.1) [/opt/src/BackendFramework.sln]
[2021-06-18 18:55:19] [build-stdout]   /usr/lib/mono/msbuild/Current/bin/NuGet.targets(128,5): error : Package SIL.DictionaryServices 8.0.0 is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Package SIL.DictionaryServices 8.0.0 supports: net461 (.NETFramework,Version=v4.6.1) [/opt/src/BackendFramework.sln]
[2021-06-18 18:55:19] [build-stdout]   /usr/lib/mono/msbuild/Current/bin/NuGet.targets(128,5): error : Package SIL.Lift 8.0.0 is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Package SIL.Lift 8.0.0 supports: net461 (.NETFramework,Version=v4.6.1) [/opt/src/BackendFramework.sln]
[2021-06-18 18:55:19] [build-stdout]     0 Warning(s)
[2021-06-18 18:55:19] [build-stdout]     6 Error(s)

@johnthagen johnthagen marked this pull request as draft June 25, 2021 14:06
@johnthagen
Copy link
Collaborator Author

johnthagen commented Jun 25, 2021

@jasonleenaylor If we decide to accept this PR, the following administrative steps will need to be performed:

  • Disable C# LGTM analysis: https://help.semmle.com/lgtm-enterprise/admin/help/disabling-analysis-language.html
  • Disable LGTM C# as a required PR check. Settings | Branches | Branch Protection Rules | Status checks that are required | Remove LGTM analysis: C#
    • (I can do this if granted temporary admin of TheCombine)
  • Settings -> Security and Analysis -> Code Scanning to make sure there is a failing commit status if any alert is found.

@johnthagen
Copy link
Collaborator Author

johnthagen commented Jun 25, 2021

Edit: For now we decided to stick to the defaults.


We may want to include some of the additional queries that CodeQL supports, but this does risk having more false positives:

security-extended Queries of lower severity and precision than the default queries
security-and-quality Queries from security-extended, plus maintainability and reliability queries

Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 13 files at r3, 10 of 16 files at r4, 2 of 2 files at r7, 1 of 1 files at r8.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec)

Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r9.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend maintenance Issue that makes it difficult to maintain the software or to upgrade installations post-release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade backend to .NET 5 Migrate away from deprecated Newtonsoft JSON serializer
3 participants