openmod icon indicating copy to clipboard operation
openmod copied to clipboard

Bump new packages

Open sunnamed434 opened this issue 2 years ago • 17 comments

NB! Breaking changes!

NuGet packages changes:

  • Microsoft.Extensions.* v3.1.32 -> Microsoft.Extensions.* v7.*, etc

  • ~~Pomelo.EntityFrameworkCore.MySql v3.2.7 -> Pomelo.EntityFrameworkCore.MySql v5.0.4~~ Decided to use Pomelo.EntityFrameworkCore.MySql v3.2.7 as before.

  • ~~Microsoft.EntityFrameworkCore. v.3.1.32 -> Microsoft.EntityFrameworkCore.* v.5.~~ Decided to use Microsoft.EntityFrameworkCore. v5.0. 14.

  • Lib.Harmony v2.2.2 -> Lib.Harmony v2.3-prerelease.3

Now OpenMod uses netstandard2.1 and netstandard2.0 only, don't use/support any more net framework

Tested with

  • uScript installed (it's ok)
  • uScript Plugins:
    • Soon...
  • Harmony (it's ok)
  • RocketMod plugins:
  • OpenMod plugins:
    • Pustalorc.PlayerInfoLib.Unturned.3.6.6 (work fine)
    • DiFFoZ.Kits (work fine)
    • Wild.Announcer (work fine)
    • New Essentials (work fine)
    • OpenMod.Economy (work fine)
    • UnturnedGuard (work fine)

Deprecated plugins

Plugins that use the provided dependencies will be deprecated:

  • ~~ILogger (because ILogger moved into another package: Microsoft.Extensions.Logging.Abstractions v7.0.1)~~ it's ok now
  • ServerVersion methods or options.ServerVersion
options.UseMySql(connectionString, sqlOptions =>
{
    // other options configuration...
    sqlOptions.ServerVersion(serverVersion); // This line should be removed now.
});

TL;DR

It's not done yet, still in the process of testing and development, sending it here to hear feedback and fix problems earlier

Yes, a lot of plugins will deprecate, but we will gonna need to proceed with a bit of work because when Unity 2022 is used in Unturned it will cause us a lot more trouble than now - better now than in the last moment.

sunnamed434 avatar Oct 20 '23 19:10 sunnamed434

@dotnet-policy-service agree

sunnamed434 avatar Oct 20 '23 20:10 sunnamed434

what about Microsoft.Extensions.* 7.*?

rube200 avatar Oct 20 '23 20:10 rube200

what about Microsoft.Extensions.* 7.*?

We can't use it while Unity on NET Framework and Netstandard, the Extensions starting with 6 and higher has target framework .NET 6/7/8 only, etc

we will be tied for a long time with netstandard2.1

sunnamed434 avatar Oct 20 '23 20:10 sunnamed434

what about Microsoft.Extensions.* 7.*?

We can't use it while Unity on NET Framework and Netstandard, the Extensions starting with 6 and higher has target framework .NET 6/7/8 only, etc

we will be tied for a long time with netstandard2.1

I just checked and nuget and seems like they are also netstandard2.0

rube200 avatar Oct 20 '23 20:10 rube200

what about Microsoft.Extensions.* 7.*?

We can't use it while Unity on NET Framework and Netstandard, the Extensions starting with 6 and higher has target framework .NET 6/7/8 only, etc we will be tied for a long time with netstandard2.1

I just checked and nuget and seems like they are also netstandard2.0

Pomelo.EntityFrameworkCore.MySql will be a problem then image

sunnamed434 avatar Oct 20 '23 20:10 sunnamed434

I guess its time to remove this also

sunnamed434 avatar Oct 20 '23 20:10 sunnamed434

because when Unity 2022 is used in Unturned it will cause us a lot more trouble than now

Why?

what about Microsoft.Extensions.* 7.*?

We can't use it while Unity on NET Framework and Netstandard, the Extensions starting with 6 and higher has target framework .NET 6/7/8 only, etc we will be tied for a long time with netstandard2.1

I just checked and nuget and seems like they are also netstandard2.0

Pomelo.EntityFrameworkCore.MySql will be a problem then

I'm still confused why is that an issue. Is there an exception or something? Don't update Pomelo.EntityFrameworkCore.MySql but just Microsoft.Extensions.

  • Pustalorc.PlayerInfoLib.Unturned.3.6.6 (doesn't work anymore)
  • DiFFoZ.Kits (doesn't work anymore)
  • Wild.Announcer (doesn't work anymore)

I don't think we can just break them. Maybe there are some workarounds.

Now this branch uses Extensions v7.* and old Pomelo

sunnamed434 avatar Oct 21 '23 08:10 sunnamed434

Problem (the same will be in OpenMod Ef Core implementations):

[12:56:59 ERR][UnturnedGuard.OpenMod.Logging.OpenModGuardLogger] An unexpected error occured while searching for a feature types!
System.TypeLoadException: Could not load type of field 'UnturnedGuard.Services.ServicesCollectionExtensions+<>c__DisplayClass6_1:serverVersion' (0) due to: Could not resolve type with token 01000027 from typeref (expected class 'Pomelo.EntityFrameworkCore.MySql.Storage.ServerVersion' in assembly 'Pomelo.EntityFrameworkCore.MySql, Version=3.2.7.0, Culture=neutral, PublicKeyToken=2cc498582444921b') assembly:Pomelo.EntityFrameworkCore.MySql, Version=3.2.7.0, Culture=neutral, PublicKeyToken=2cc498582444921b type:Pomelo.EntityFrameworkCore.MySql.Storage.ServerVersion member:(null)
  at (wrapper managed-to-native) System.RuntimeTypeHandle.type_is_assignable_from(System.Type,System.Type)
  at System.RuntimeTypeHandle.CanCastTo (System.RuntimeType type, System.RuntimeType target) [0x00000] in <47fc8c70fa834cbf8141d7c1a7589125>:0
  at System.RuntimeType.IsAssignableFrom (System.Type c) [0x00020] in <47fc8c70fa834cbf8141d7c1a7589125>:0
  at UnturnedGuard.Services.ServicesCollectionExtensions+<>c.<RegisterFeatures>b__1_0 (System.Type t) [0x00000] in <8a4886ce9e5d4379b6cf9f641dc1eb5a>:0
  at System.Linq.Enumerable+WhereArrayIterator`1[TSource].MoveNext () [0x0002c] in <d61464951b0243f18092630834a7bf18>:0
  at System.Collections.Generic.List`1[T].AddEnumerable (System.Collections.Generic.IEnumerable`1[T] enumerable) [0x00059] in <47fc8c70fa834cbf8141d7c1a7589125>:0
  at System.Collections.Generic.List`1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable`1[T] collection) [0x000f4] in <47fc8c70fa834cbf8141d7c1a7589125>:0
  at System.Collections.Generic.List`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] collection) [0x00000] in <47fc8c70fa834cbf8141d7c1a7589125>:0
  at UnturnedGuard.Services.ServicesCollectionExtensions.RegisterFeatures (Microsoft.Extensions.DependencyInjection.IServiceCollection source, UnturnedGuard.Guard.Logging.IGuardLogger logger, UnturnedGuard.Shared.Models.UnturnedGuardSettings settings) [0x0004e] in <8a4886ce9e5d4379b6cf9f641dc1eb5a>:0

2 Solutions:

  • Use v5.* of the Pomelo
  • Don't use options.ServerVersion() (this one is being used right now as a solution)

As I said before to avoid misunderstanding by other devs using Microsoft.* and Pomelo API it is better to use Pomelo and Ef Core with v5.*

sunnamed434 avatar Oct 21 '23 10:10 sunnamed434

Currently blocking to make decision about updating Harmony to the Harmony v2.3-prerelease.2, because v2.2.2 causes compile issue with transpiler patch (Label reference mismatch, see image). image

DiFFoZ avatar Oct 26 '23 14:10 DiFFoZ

Currently blocking to make decision about updating Harmony to the Harmony v2.3-prerelease.2, because v2.2.2 causes compile issue with transpiler patch (Label reference mismatch, see image). image

Perhaps it is more a VS problem, I use JetBrains Rider, and it is okay for me, but anyway, I changed the version to the latest Harmony prerelease v3, updated runtime libs, and fixed other issues

sunnamed434 avatar Oct 27 '23 19:10 sunnamed434

Fixed branch conflicts

sunnamed434 avatar Nov 05 '23 19:11 sunnamed434

There are new conflicts

Trojaner avatar Nov 07 '23 16:11 Trojaner

Fixed conflicts

sunnamed434 avatar Nov 07 '23 23:11 sunnamed434

Fixed conflicts

sunnamed434 avatar Nov 08 '23 13:11 sunnamed434

Fixed conflicts

sunnamed434 avatar Nov 12 '23 14:11 sunnamed434

Unless there are objections, this will probably be merged with OpenMod 3.8

Trojaner avatar Nov 17 '23 12:11 Trojaner

Before releasing the new version, we should ping devs about the EF Core error that currently is forced to silent, see commit https://github.com/openmod/openmod/pull/772/commits/6e73e4d7bcb155c0e23784cdc90a1251a656256f

DiFFoZ avatar Nov 17 '23 14:11 DiFFoZ

Given the huge amount of conflicts and age, I redid the PR and merged manually. Thanks for your contributions.

Trojaner avatar May 21 '24 23:05 Trojaner