Cs0618 c# application.loadlevel(int) ist veraltet: use scenemanager.loadscene

Hello All, i'm hoping if someone can help me?

I am trying to publish my site and it will just not go through, and below is the only error i am receiving, has anybody come across this before?

Many thanks in advance

Jake

------ Build started: Project: C:\...\dotnetnuke5\, Configuration: Debug Any CPU ------

Pre-compiling Web Site

Building directory '/dotnetnuke5/App_GlobalResources/'.C:\inetpub\wwwroot\dotnetnuke5\DesktopModules\DNNGo_SuperForm\Effects\S001_Normal\S001_NormalSettings.ascx(1): Publication (web): Could not load type 'DNNGo.LoginIntegration.L001_NormalSettings'.

C:\inetpub\wwwroot\dotnetnuke5\DesktopModules\Admin\SQL\SQL.ascx.cs(135,40): warning CS0618: 'DotNetNuke.Data.DataProvider.ExecuteScript(string, string)' is obsolete: 'Temporarily Added in DNN 5.4.2. This will be removed and replaced with named instance support.'

Pre-compilation Complete

------ Skipped Publish: Project C:\...\dotnetnuke5\, Configuration: Debug Any CPU ------

========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

========== Publish: 0 succeeded, 0 failed, 1 skipped ==========

Description

If an application uses the .NET 6 source generator for JSON with type(s) that have one or more properties decorated with the [Obsolete] property, three CS0618 warnings will be emitted by the compiler for each such property.

If the application does not control the code of all of the types it (de)serializes these warnings cannot be worked around by removing the properties' obsolete attributes (for example when using shared models distributed via NuGet).

If the application uses TreatWarningsAsErrors or any obsolete properties are marked as an error to use, the application fails to compile.

Reproduction Steps

Compile the following application using the .NET 6.0.100 SDK with dotnet build.

using System.Text; using System.Text.Json; using System.Text.Json.Serialization; var value = new MyObject { NewValue = "Hello World" }; var bytes = JsonSerializer.SerializeToUtf8Bytes(value, typeof(MyObject), new MyJsonContext(new (JsonSerializerDefaults.Web))); var json = Encoding.UTF8.GetString(bytes); Console.WriteLine(json); public class MyObject { public string? NewValue {get; set; } [Obsolete("Use NewValue instead")] public string? OldValue {get; set; } } [JsonSerializable(typeof(MyObject))] public partial class MyJsonContext : JsonSerializerContext { }

<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <ImplicitUsings>enable</ImplicitUsings> <NoWarn>$(NoWarn);CA1050</NoWarn> <Nullable>enable</Nullable> <OutputType>Exe</OutputType> <TargetFramework>net6.0</TargetFramework> </PropertyGroup> </Project>

Expected behavior

The application compiles with zero warnings/errors due to the obsolete properties not being used by user code.

Actual behavior

The application emits three CS0618 warnings per obsolete property from usages in the generated code.

> dotnet build Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET Copyright (C) Microsoft Corporation. All rights reserved. Determining projects to restore... All projects are up-to-date for restore. C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\MyJsonContext.MyObject.g.cs(72,42): warning CS0618: 'MyObject.OldValue' is obsolete: 'Use NewValue instead' [C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\JsonSourceGeneratorObsoleteProperties.csproj] C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\MyJsonContext.MyObject.g.cs(73,49): warning CS0618: 'MyObject.OldValue' is obsolete: 'Use NewValue instead' [C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\JsonSourceGeneratorObsoleteProperties.csproj] C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\MyJsonContext.MyObject.g.cs(97,51): warning CS0618: 'MyObject.OldValue' is obsolete: 'Use NewValue instead' [C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\JsonSourceGeneratorObsoleteProperties.csproj] JsonSourceGeneratorObsoleteProperties -> C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\bin\Debug\net6.0\JsonSourceGeneratorObsoleteProperties.dll Build succeeded. C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\MyJsonContext.MyObject.g.cs(72,42): warning CS0618: 'MyObject.OldValue' is obsolete: 'Use NewValue instead' [C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\JsonSourceGeneratorObsoleteProperties.csproj] C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\MyJsonContext.MyObject.g.cs(73,49): warning CS0618: 'MyObject.OldValue' is obsolete: 'Use NewValue instead' [C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\JsonSourceGeneratorObsoleteProperties.csproj] C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\MyJsonContext.MyObject.g.cs(97,51): warning CS0618: 'MyObject.OldValue' is obsolete: 'Use NewValue instead' [C:\Coding\martincostello\JsonSourceGeneratorObsoleteProperties\JsonSourceGeneratorObsoleteProperties.csproj] 3 Warning(s) 0 Error(s) Time Elapsed 00:00:01.99

Regression?

No.

Known Workarounds

No response

Configuration

Partial output from dotnet --info:

> dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.100 Commit: 9e8b04bbff Runtime Environment: OS Name: Windows OS Version: 10.0.19043 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.100\ Host (useful for support): Version: 6.0.0 Commit: 4822e3c3aa

Other information

No response

Toplist

Neuester Beitrag

Stichworte