logging-log4net icon indicating copy to clipboard operation
logging-log4net copied to clipboard

.NET8.0 XML Exception Problem

Open SwEngine opened this issue 1 year ago • 16 comments

I was using the package in .net7.0 without problems. However, after updating to .net8.0, my program throws error. When I unchecked the trimming unused code option, there was no error, but it increases output file size very much. How can I solve it?

SwEngine avatar Apr 18 '24 05:04 SwEngine

Hi @SwEngine,

can you please be more specific? What exact error do you get when you do what?

FreeAndNil avatar Apr 18 '24 06:04 FreeAndNil

I use only normal logging processes. When releasing the executable, I checked the trimming unused code option, it gives the error below, However, when I unchecked the trimming unused code option, it does not give any error.

log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize
 ---> System.MissingMethodException: Cannot dynamically create an instance of type 'System.Configuration.ClientConfigurationHost'. Reason: No parameterless constructor defined.
   at System.RuntimeType.ActivatorCache..ctor(RuntimeType)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean)
   at System.Configuration.Internal.ConfigSystem.System.Configuration.Internal.IConfigSystem.Init(Type, Object[] )
   at System.Configuration.ClientConfigurationSystem..ctor()
   at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
   --- End of inner exception stack trace ---
   at System.Configuration.ConfigurationManager.PrepareConfigSystem()
   at System.Configuration.ConfigurationManager.GetSection(String)
   at System.Configuration.ConfigurationManager.get_AppSettings()
   at log4net.Util.SystemInfo.GetAppSetting(String)
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize
 ---> System.MissingMethodException: Cannot dynamically create an instance of type 'System.Configuration.ClientConfigurationHost'. Reason: No parameterless constructor defined.
   at System.RuntimeType.ActivatorCache..ctor(RuntimeType)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean)
   at System.Configuration.Internal.ConfigSystem.System.Configuration.Internal.IConfigSystem.Init(Type, Object[] )
   at System.Configuration.ClientConfigurationSystem..ctor()
   at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
   --- End of inner exception stack trace ---
   at System.Configuration.ConfigurationManager.PrepareConfigSystem()
   at System.Configuration.ConfigurationManager.GetSection(String)
   at System.Configuration.ConfigurationManager.get_AppSettings()
   at log4net.Util.SystemInfo.GetAppSetting(String)
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize
 ---> System.MissingMethodException: Cannot dynamically create an instance of type 'System.Configuration.ClientConfigurationHost'. Reason: No parameterless constructor defined.
   at System.RuntimeType.ActivatorCache..ctor(RuntimeType)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean)
   at System.Configuration.Internal.ConfigSystem.System.Configuration.Internal.IConfigSystem.Init(Type, Object[] )
   at System.Configuration.ClientConfigurationSystem..ctor()
   at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
   --- End of inner exception stack trace ---
   at System.Configuration.ConfigurationManager.PrepareConfigSystem()
   at System.Configuration.ConfigurationManager.GetSection(String)
   at System.Configuration.ConfigurationManager.get_AppSettings()
   at log4net.Util.SystemInfo.GetAppSetting(String)
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize
 ---> System.MissingMethodException: Cannot dynamically create an instance of type 'System.Configuration.ClientConfigurationHost'. Reason: No parameterless constructor defined.
   at System.RuntimeType.ActivatorCache..ctor(RuntimeType)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean)
   at System.Configuration.Internal.ConfigSystem.System.Configuration.Internal.IConfigSystem.Init(Type, Object[] )
   at System.Configuration.ClientConfigurationSystem..ctor()
   at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
   --- End of inner exception stack trace ---
   at System.Configuration.ConfigurationManager.PrepareConfigSystem()
   at System.Configuration.ConfigurationManager.GetSection(String)
   at System.Configuration.ConfigurationManager.get_AppSettings()
   at log4net.Util.SystemInfo.GetAppSetting(String)
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize
 ---> System.MissingMethodException: Cannot dynamically create an instance of type 'System.Configuration.ClientConfigurationHost'. Reason: No parameterless constructor defined.
   at System.RuntimeType.ActivatorCache..ctor(RuntimeType)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean)
   at System.Configuration.Internal.ConfigSystem.System.Configuration.Internal.IConfigSystem.Init(Type, Object[] )
   at System.Configuration.ClientConfigurationSystem..ctor()
   at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
   --- End of inner exception stack trace ---
   at System.Configuration.ConfigurationManager.PrepareConfigSystem()
   at System.Configuration.ConfigurationManager.GetSection(String)
   at System.Configuration.ConfigurationManager.get_AppSettings()
   at log4net.Util.SystemInfo.GetAppSetting(String)
log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize
 ---> System.MissingMethodException: Cannot dynamically create an instance of type 'System.Configuration.ClientConfigurationHost'. Reason: No parameterless constructor defined.
   at System.RuntimeType.ActivatorCache..ctor(RuntimeType)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean)
   at System.Configuration.Internal.ConfigSystem.System.Configuration.Internal.IConfigSystem.Init(Type, Object[] )
   at System.Configuration.ClientConfigurationSystem..ctor()
   at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
   --- End of inner exception stack trace ---
   at System.Configuration.ConfigurationManager.PrepareConfigSystem()
   at System.Configuration.ConfigurationManager.GetSection(String)
   at System.Configuration.ConfigurationManager.get_AppSettings()
   at log4net.Util.SystemInfo.GetAppSetting(String)
Program::Run msg=The type initializer for 'log4net.Core.LoggerManager' threw an exception.
Unhandled exception. System.TypeInitializationException: The type initializer for 'log4net.Core.LoggerManager' threw an exception.
 ---> System.ArgumentOutOfRangeException: Parameter: defaultRepositoryType, Value: [log4net.Repository.Hierarchy.Hierarchy] out of range. Argument must implement the ILoggerRepository interface (Parameter 'defaultRepositoryType')
Actual value was log4net.Repository.Hierarchy.Hierarchy.
   at log4net.Core.DefaultRepositorySelector..ctor(Type)
   at log4net.Core.LoggerManager..cctor()
   --- End of inner exception stack trace ---
   at log4net.Core.LoggerManager.OnProcessExit(Object sender, EventArgs e)
   at System.AppContext.OnProcessExit()

SwEngine avatar Apr 18 '24 08:04 SwEngine

@SwEngine thanks for the info. Can you check whether the change in #143 works for you?

FreeAndNil avatar Apr 18 '24 08:04 FreeAndNil

I could not build your code :( could you share a dll file? Sorry for inconvenience

SwEngine avatar Apr 18 '24 09:04 SwEngine

@SwEngine netstandard2.0.zip

FreeAndNil avatar Apr 18 '24 10:04 FreeAndNil

I am adding your dll file to my project from project references, however

logger = LogManager.GetLogger(typeof(Logger));

this line gives error of:

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0012	The type 'Assembly' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.	Logger	C:\Users\Desktop\Logger\Logger\Logger.cs	15	N/A

SwEngine avatar Apr 18 '24 11:04 SwEngine

Can you put a simple repro somewhere on Github?

FreeAndNil avatar Apr 18 '24 12:04 FreeAndNil

@SwEngine maybe posting your csproj file could also help

FreeAndNil avatar Apr 19 '24 11:04 FreeAndNil

@SwEngine is this still relevant for you? Otherwise I will close this at the end of the week.

FreeAndNil avatar Apr 23 '24 13:04 FreeAndNil

I am on vacation, but next week I will look at again, thank you so much!

SwEngine avatar Apr 25 '24 05:04 SwEngine

@SwEngine could you take a look?

FreeAndNil avatar May 12 '24 20:05 FreeAndNil

@SwEngine please reopen when you have feedback

FreeAndNil avatar May 24 '24 09:05 FreeAndNil

I have the same error in relatively simple project. Error does not occur on dev environment. Error occurs in the docker image. I use Microsoft.Extensions.Logging.Log4Net.AspNetCore to integrate log4net and my app. It handles only log4net.config so it can be a problem. I prefer not to keep project private (I'm not sure if repo contains some auth data) but I can share it with 1 or 2 persons (on Gitlab)

Edit: Here is a link to the same issue in integration library: https://github.com/huorswords/Microsoft.Extensions.Logging.Log4Net.AspNetCore/issues/138

szogun1987 avatar Aug 28 '24 19:08 szogun1987

I have also build log:

/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.extensions.logging.log4net.aspnetcore/8.0.0/lib/net8.0/Microsoft.Extensions.Logging.Log4Net.AspNetCore.dll : warning IL2104: Assembly 'Microsoft.Extensions.Logging.Log4Net.AspNetCore' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/log4net/2.0.15/lib/netstandard2.0/log4net.dll : warning IL3053: Assembly 'log4net' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.ViewFeatures.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.ViewFeatures' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/log4net/2.0.15/lib/netstandard2.0/log4net.dll : warning IL2104: Assembly 'log4net' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
ILC : warning IL3000: log4net.Util.SystemInfo.EntryAssemblyLocation.get: 'System.Reflection.Assembly.Location.get' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.Core.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.Core' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Components.Endpoints.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Components.Endpoints' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Components.Endpoints.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Components.Endpoints' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
ILC : warning IL3000: log4net.Util.SystemInfo.AssemblyLocationInfo(Assembly): 'System.Reflection.Assembly.Location.get' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Components.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Components' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/system.configuration.configurationmanager/4.5.0/lib/netstandard2.0/System.Configuration.ConfigurationManager.dll : warning IL2104: Assembly 'System.Configuration.ConfigurationManager' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
ILC : warning IL3000: Microsoft.AspNetCore.Mvc.ApplicationParts.RelatedAssemblyAttribute.GetRelatedAssemblies(Assembly,Boolean,Func`2<String,Boolean>,RelatedAssemblyAttribute.AssemblyLoadContextWrapper): 'System.Reflection.Assembly.Location.get' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
ILC : warning IL3000: Microsoft.AspNetCore.Mvc.ApplicationParts.RelatedAssemblyAttribute.GetRelatedAssemblies(Assembly,Boolean,Func`2<String,Boolean>,RelatedAssemblyAttribute.AssemblyLoadContextWrapper): 'System.Reflection.Assembly.Location.get' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.Core.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Mvc.Core' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.RazorPages.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.RazorPages' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/newtonsoft.json/13.0.1/lib/netstandard2.0/Newtonsoft.Json.dll : warning IL2104: Assembly 'Newtonsoft.Json' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.Abstractions.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.Abstractions' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.ViewFeatures.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Mvc.ViewFeatures' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.Abstractions.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Mvc.Abstractions' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/newtonsoft.json/13.0.1/lib/netstandard2.0/Newtonsoft.Json.dll : warning IL3053: Assembly 'Newtonsoft.Json' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
ILC : warning IL3002: System.Configuration.ClientConfigPaths.ClientConfigPaths(String,Boolean): Using member 'System.Reflection.Module.Name.get' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. Returns <Unknown> for modules with no file path. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
ILC : warning IL3002: System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(String): Using member 'System.Reflection.Module.Name.get' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. Returns <Unknown> for modules with no file path. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.Razor.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.Razor' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.Razor.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Mvc.Razor' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.RazorPages.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Mvc.RazorPages' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Mvc.DataAnnotations.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Mvc.DataAnnotations' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.8/framework/System.Linq.Expressions.dll : warning IL3053: Assembly 'System.Linq.Expressions' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataTable.cs(6722): Trim analysis warning IL2026: System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter): Using member 'System.Data.DataTable.WriteXmlInternal(XmlWriter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataTable.WriteXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataSet.cs(3529): Trim analysis warning IL2026: System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter): Using member 'System.Data.DataSet.WriteXmlInternal(XmlWriter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataSet.WriteXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.8/framework/Microsoft.CSharp.dll : warning IL3053: Assembly 'Microsoft.CSharp' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/microsoft.aspnetcore.app.runtime.linux-x64/8.0.8/runtimes/linux-x64/lib/net8.0/Microsoft.AspNetCore.Components.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Components' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/root/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.8/framework/System.Private.Xml.dll : warning IL3053: Assembly 'System.Private.Xml' produced AOT analysis warnings. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataTable.cs(6704): Trim analysis warning IL2026: System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader): Using member 'System.Data.DataTable.ReadXmlSerializableInternal(XmlReader)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataTable.ReadXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataSet.cs(3507): Trim analysis warning IL2026: System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader): Using member 'System.Data.DataSet.ReadXmlSerializableInternal(XmlReader)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataSet.ReadXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataTable.cs(6668): Trim analysis warning IL2026: System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.GetSchema(): Using member 'System.Data.DataTable.GetXmlSchema()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataTable.GetSchema uses TypeDescriptor and XmlSerialization underneath which are not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataSet.cs(3473): Trim analysis warning IL2026: System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.GetSchema(): Using member 'System.Data.DataSet.WriteXmlSchema(DataSet,XmlWriter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataSet.GetSchema uses TypeDescriptor and XmlSerialization underneath which are not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/opt/atlassian/pipelines/agent/build/src/SzogunUI.Skupomat.Auth.Web/SzogunUI.Skupomat.Auth.Web.csproj]

szogun1987 avatar Aug 28 '24 20:08 szogun1987

@szogun1987 can you create a minimal sample project reproducing the problem?

FreeAndNil avatar Aug 28 '24 20:08 FreeAndNil

ApacheLog4NetSample.zip Just open WebApplication1 folder and run

docker build -t web-app:0.0.1-local .
docker run -it --rm web-app:0.0.1-local

in it.

szogun1987 avatar Aug 29 '24 07:08 szogun1987