diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 808da9d5c2..a31dacae3f 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -42,7 +42,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.100 + dotnet-version: 6.0.100 - name: Install dependencies run: dotnet restore - name: Build diff --git a/.github/workflows/yaml-linter.yml b/.github/workflows/yaml-linter.yml index f43bd44093..da768c4dbf 100644 --- a/.github/workflows/yaml-linter.yml +++ b/.github/workflows/yaml-linter.yml @@ -19,7 +19,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.100 + dotnet-version: 6.0.100 - name: Install dependencies run: dotnet restore - name: Build diff --git a/Content.Benchmarks/Content.Benchmarks.csproj b/Content.Benchmarks/Content.Benchmarks.csproj index 0c3db095da..4db67a4c60 100644 --- a/Content.Benchmarks/Content.Benchmarks.csproj +++ b/Content.Benchmarks/Content.Benchmarks.csproj @@ -8,7 +8,7 @@ false Exe true - 9 + 10 diff --git a/Content.Client/Content.Client.csproj b/Content.Client/Content.Client.csproj index 183e06394f..153483e0d7 100644 --- a/Content.Client/Content.Client.csproj +++ b/Content.Client/Content.Client.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 9 + 10 false false ..\bin\Content.Client\ diff --git a/Content.IntegrationTests/Content.IntegrationTests.csproj b/Content.IntegrationTests/Content.IntegrationTests.csproj index c163cffa0c..01d0ccbe14 100644 --- a/Content.IntegrationTests/Content.IntegrationTests.csproj +++ b/Content.IntegrationTests/Content.IntegrationTests.csproj @@ -6,7 +6,7 @@ ..\bin\Content.IntegrationTests\ false false - 9 + 10 diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs index 4801d20d4e..ed54c7652b 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs @@ -68,9 +68,9 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking // Test for components existing Assert.True(human.TryGetComponent(out cuffed!), $"Human has no {nameof(CuffableComponent)}"); Assert.True(human.TryGetComponent(out hands!), $"Human has no {nameof(HandsComponent)}"); - Assert.True(human.TryGetComponent(out SharedBodyComponent _), $"Human has no {nameof(SharedBodyComponent)}"); - Assert.True(cuffs.TryGetComponent(out HandcuffComponent _), $"Handcuff has no {nameof(HandcuffComponent)}"); - Assert.True(secondCuffs.TryGetComponent(out HandcuffComponent _), $"Second handcuffs has no {nameof(HandcuffComponent)}"); + Assert.True(human.TryGetComponent(out SharedBodyComponent? _), $"Human has no {nameof(SharedBodyComponent)}"); + Assert.True(cuffs.TryGetComponent(out HandcuffComponent? _), $"Handcuff has no {nameof(HandcuffComponent)}"); + Assert.True(secondCuffs.TryGetComponent(out HandcuffComponent? _), $"Second handcuffs has no {nameof(HandcuffComponent)}"); // Test to ensure cuffed players register the handcuffs cuffed.TryAddNewCuffs(human, cuffs); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index 8d13ee7c47..f1fad255fa 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -55,7 +55,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement // Test for climb components existing // Players and tables should have these in their prototypes. Assert.That(human.TryGetComponent(out climbing!), "Human has no climbing"); - Assert.That(table.TryGetComponent(out ClimbableComponent _), "Table has no climbable"); + Assert.That(table.TryGetComponent(out ClimbableComponent? _), "Table has no climbable"); // Now let's make the player enter a climbing transitioning state. climbing.IsClimbing = true; diff --git a/Content.Server.Database/Content.Server.Database.csproj b/Content.Server.Database/Content.Server.Database.csproj index 169b726d5c..b68dee8482 100644 --- a/Content.Server.Database/Content.Server.Database.csproj +++ b/Content.Server.Database/Content.Server.Database.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 9 + 10 false false ..\bin\Content.Server.Database\ @@ -13,12 +13,12 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + diff --git a/Content.Server.Database/ModelPostgres.cs b/Content.Server.Database/ModelPostgres.cs index 2ee28db9a5..da2c41cb24 100644 --- a/Content.Server.Database/ModelPostgres.cs +++ b/Content.Server.Database/ModelPostgres.cs @@ -2,6 +2,7 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Net; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage; @@ -28,6 +29,11 @@ namespace Content.Server.Database options.ReplaceService(); ((IDbContextOptionsBuilderInfrastructure) options).AddOrUpdateExtension(new SnakeCaseExtension()); + + options.ConfigureWarnings(x => + { + x.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning); + }); } public PostgresServerDbContext(DbContextOptions options) : base(options) @@ -82,7 +88,7 @@ namespace Content.Server.Database { foreach(var property in entity.GetProperties()) { - if (property.FieldInfo.FieldType == typeof(DateTime) || property.FieldInfo.FieldType == typeof(DateTime?)) + if (property.FieldInfo?.FieldType == typeof(DateTime) || property.FieldInfo?.FieldType == typeof(DateTime?)) property.SetColumnType("timestamp with time zone"); } } diff --git a/Content.Server.Database/ModelSqlite.cs b/Content.Server.Database/ModelSqlite.cs index 0eaaf3072c..1304666c72 100644 --- a/Content.Server.Database/ModelSqlite.cs +++ b/Content.Server.Database/ModelSqlite.cs @@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Globalization; using System.Net; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; @@ -25,6 +26,11 @@ namespace Content.Server.Database options.UseSqlite("dummy connection string"); ((IDbContextOptionsBuilderInfrastructure) options).AddOrUpdateExtension(new SnakeCaseExtension()); + + options.ConfigureWarnings(x => + { + x.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning); + }); } protected override void OnModelCreating(ModelBuilder modelBuilder) diff --git a/Content.Server.Database/SnakeCaseNaming.cs b/Content.Server.Database/SnakeCaseNaming.cs index e9b204d5ac..f19c386d96 100644 --- a/Content.Server.Database/SnakeCaseNaming.cs +++ b/Content.Server.Database/SnakeCaseNaming.cs @@ -33,7 +33,12 @@ namespace Content.Server.Database public override string LogFragment => "Snake Case Extension"; - public override long GetServiceProviderHashCode() => 0; + public override int GetServiceProviderHashCode() => 0; + + public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other) + { + return false; + } public override void PopulateDebugInfo(IDictionary debugInfo) { @@ -118,26 +123,26 @@ namespace Content.Server.Database if (entityType.BaseType is null) { - entityTypeBuilder.ToTable(RewriteName(entityType.GetTableName()), entityType.GetSchema()); + entityTypeBuilder.ToTable(RewriteName(entityType.GetTableName()!), entityType.GetSchema()); if (entityType.GetViewNameConfigurationSource() == ConfigurationSource.Convention) { - entityTypeBuilder.ToView(RewriteName(entityType.GetViewName()), entityType.GetViewSchema()); + entityTypeBuilder.ToView(RewriteName(entityType.GetViewName()!), entityType.GetViewSchema()); } } } public void ProcessEntityTypeBaseTypeChanged( IConventionEntityTypeBuilder entityTypeBuilder, - IConventionEntityType newBaseType, - IConventionEntityType oldBaseType, + IConventionEntityType? newBaseType, + IConventionEntityType? oldBaseType, IConventionContext context) { var entityType = entityTypeBuilder.Metadata; if (newBaseType is null) { - entityTypeBuilder.ToTable(RewriteName(entityType.GetTableName()), entityType.GetSchema()); + entityTypeBuilder.ToTable(RewriteName(entityType.GetTableName()!), entityType.GetSchema()); } else { @@ -173,8 +178,8 @@ namespace Content.Server.Database public void ProcessEntityTypeAnnotationChanged( IConventionEntityTypeBuilder entityTypeBuilder, string name, - IConventionAnnotation annotation, - IConventionAnnotation oldAnnotation, + IConventionAnnotation? annotation, + IConventionAnnotation? oldAnnotation, IConventionContext context) { var entityType = entityTypeBuilder.Metadata; @@ -216,7 +221,7 @@ namespace Content.Server.Database && (string)annotation.Value != ownership.PrincipalEntityType.GetTableName()) { foreach (var property in entityType.GetProperties() - .Except(entityType.FindPrimaryKey().Properties) + .Except(entityType.FindPrimaryKey()!.Properties) .Where(p => p.Builder.CanSetColumnName(null))) { RewriteColumnName(property.Builder); @@ -271,7 +276,7 @@ namespace Content.Server.Database if (property.GetColumnNameConfigurationSource(identifier.Value) == ConfigurationSource.Convention) { - columnName = property.GetColumnName(identifier.Value); + columnName = property.GetColumnName(identifier.Value)!; if (columnName.StartsWith(entityType.ShortName() + '_', StringComparison.Ordinal)) { property.Builder.HasColumnName( @@ -314,7 +319,7 @@ namespace Content.Server.Database if (name == "Id") name = entityType.GetTableName() + name; propertyBuilder.HasColumnName( - RewriteName(name), identifier.Value); + RewriteName(name!), identifier.Value); } } } diff --git a/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs b/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs index 36a0768a32..28d6b32aff 100644 --- a/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs +++ b/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs @@ -2,7 +2,6 @@ using Content.Server.Chemistry.EntitySystems; using Content.Server.Inventory.Components; using Content.Server.Items; -using Content.Shared.Chemistry.Reagent; using Content.Shared.FixedPoint; using Content.Shared.Foam; using Content.Shared.Inventory; @@ -51,7 +50,7 @@ namespace Content.Server.Chemistry.Components slot == EquipmentSlotDefines.Slots.IDCARD) continue; - if (inventory.TryGetSlotItem(slot, out ItemComponent _)) + if (inventory.TryGetSlotItem(slot, out ItemComponent? _)) protection += 0.025f; } } diff --git a/Content.Server/Content.Server.csproj b/Content.Server/Content.Server.csproj index 33421f41bb..5bf3663da1 100644 --- a/Content.Server/Content.Server.csproj +++ b/Content.Server/Content.Server.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 9 + 10 false false ..\bin\Content.Server\ diff --git a/Content.Server/Database/ServerDbBase.cs b/Content.Server/Database/ServerDbBase.cs index 143b50aada..355e24608b 100644 --- a/Content.Server/Database/ServerDbBase.cs +++ b/Content.Server/Database/ServerDbBase.cs @@ -93,6 +93,11 @@ namespace Content.Server.Database .Where(p => p.Preference.UserId == userId.UserId && p.Slot == slot) .SingleOrDefaultAsync(); + if (profile == null) + { + return; + } + db.Profile.Remove(profile); } diff --git a/Content.Server/Database/ServerDbManager.cs b/Content.Server/Database/ServerDbManager.cs index d8f419046f..c9e7adfb78 100644 --- a/Content.Server/Database/ServerDbManager.cs +++ b/Content.Server/Database/ServerDbManager.cs @@ -5,7 +5,6 @@ using System.IO; using System.Net; using System.Threading; using System.Threading.Tasks; -using Content.Shared; using Content.Shared.CCVar; using Content.Shared.Preferences; using Microsoft.Data.Sqlite; @@ -382,8 +381,8 @@ namespace Content.Server.Database _sawmill = sawmill; } - public void Log(MSLogLevel logLevel, EventId eventId, TState state, Exception exception, - Func formatter) + public void Log(MSLogLevel logLevel, EventId eventId, TState state, Exception? exception, + Func formatter) { var lvl = logLevel switch { diff --git a/Content.Server/Inventory/InventoryHelpers.cs b/Content.Server/Inventory/InventoryHelpers.cs index 438ac1e285..30a07de4bc 100644 --- a/Content.Server/Inventory/InventoryHelpers.cs +++ b/Content.Server/Inventory/InventoryHelpers.cs @@ -19,7 +19,7 @@ namespace Content.Server.Inventory return false; // If we don't have that slot or there's already an item there, we do nothing. - if (!inventory.HasSlot(slot) || inventory.TryGetSlotItem(slot, out ItemComponent _)) + if (!inventory.HasSlot(slot) || inventory.TryGetSlotItem(slot, out ItemComponent? _)) return false; // If the prototype in question doesn't exist, we do nothing. diff --git a/Content.Server/Strip/StrippableComponent.cs b/Content.Server/Strip/StrippableComponent.cs index a3bcea18b4..3a4f6deab0 100644 --- a/Content.Server/Strip/StrippableComponent.cs +++ b/Content.Server/Strip/StrippableComponent.cs @@ -178,7 +178,7 @@ namespace Content.Server.Strip if (!inventory.HasSlot(slot)) return false; - if (inventory.TryGetSlotItem(slot, out ItemComponent _)) + if (inventory.TryGetSlotItem(slot, out ItemComponent? _)) { user.PopupMessageCursor(Loc.GetString("strippable-component-item-slot-occupied",("owner", Owner))); return false; @@ -403,7 +403,7 @@ namespace Content.Server.Strip if (Owner.TryGetComponent(out var inventory)) { - if (inventory.TryGetSlotItem(inventoryMessage.Slot, out ItemComponent _)) + if (inventory.TryGetSlotItem(inventoryMessage.Slot, out ItemComponent? _)) placingItem = false; if (placingItem) diff --git a/Content.Shared/Content.Shared.csproj b/Content.Shared/Content.Shared.csproj index 86e05845c9..13210533c3 100644 --- a/Content.Shared/Content.Shared.csproj +++ b/Content.Shared/Content.Shared.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 9 + 10 false false Release;Debug diff --git a/Content.Tests/Content.Tests.csproj b/Content.Tests/Content.Tests.csproj index 6733051ad8..463ba9046d 100644 --- a/Content.Tests/Content.Tests.csproj +++ b/Content.Tests/Content.Tests.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 9 + 10 false false ..\bin\Content.Tests\ diff --git a/Content.Tools/Content.Tools.csproj b/Content.Tools/Content.Tools.csproj index eaf70966a4..10544d15fd 100644 --- a/Content.Tools/Content.Tools.csproj +++ b/Content.Tools/Content.Tools.csproj @@ -1,8 +1,8 @@ - + Exe - net5.0 + $(TargetFramework) diff --git a/Content.YAMLLinter/Content.YAMLLinter.csproj b/Content.YAMLLinter/Content.YAMLLinter.csproj index 5ac8a6e866..8974c6ea21 100644 --- a/Content.YAMLLinter/Content.YAMLLinter.csproj +++ b/Content.YAMLLinter/Content.YAMLLinter.csproj @@ -1,8 +1,8 @@ - + Exe - net5.0 + $(TargetFramework) ..\bin\Content.YAMLLinter\ false diff --git a/Pow3r/Pow3r.csproj b/Pow3r/Pow3r.csproj index d86f41e139..9a9b8c3bf3 100644 --- a/Pow3r/Pow3r.csproj +++ b/Pow3r/Pow3r.csproj @@ -1,8 +1,8 @@  - + Exe - net5.0 + $(TargetFramework) true diff --git a/RobustToolbox b/RobustToolbox index 9b215098e4..1c8ed1c5b2 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 9b215098e4a948d39b54fdc7600182a394ebdb13 +Subproject commit 1c8ed1c5b2cbd9c5568aca1de978fd18c339adf8