Closed heppth closed 3 years ago
I figured it out. Was not easy:
<Assembly Name="System.Text.Json">
<Type Name="System.Text.Json.Serialization.Converters.IEnumerableOfTConverter`2[[System.Collections.Generic.IEnumerable`1[[Swashbuckle.AspNetCore.SwaggerUI.UrlDescriptor,Swashbuckle.AspNetCore.SwaggerUI]],mscorlib],[Swashbuckle.AspNetCore.SwaggerUI.UrlDescriptor,Swashbuckle.AspNetCore.SwaggerUI]]" Dynamic="Required All" />
</Assembly>
@heppth What does' 2 stand for, this grammar does not understand
@heppth can you help me my error is
Connection id "0HMLDPGDK1NPD", Request id "0HMLDPGDK1NPD:00000002": An unhandled exception was thrown by the application.
System.Reflection.MissingMetadataException: 'System.Text.Json.Serialization.Converters.SmallObjectWithParameterizedConstructorConverter<<>f__AnonymousType6<System.Int32,System.Int32,System.String>,System.Int32,System.Int32,System.String,System.Object>' is missing metadata. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=392859
at System.Reflection.Runtime.General.TypeUnifier.WithVerifiedTypeHandle(RuntimeConstructedGenericTypeInfo, RuntimeTypeInfo[]) + 0x8f
at System.Text.Json.Serialization.Converters.ObjectConverterFactory.CreateConverter(Type, JsonSerializerOptions) + 0x1e9
at System.Text.Json.Serialization.JsonConverterFactory.GetConverterInternal(Type, JsonSerializerOptions) + 0x15
at System.Text.Json.JsonSerializerOptions.GetConverterInternal(Type) + 0x21c
at System.Text.Json.JsonSerializerOptions.DetermineConverter(Type, Type, MemberInfo) + 0x92
at System.Text.Json.Serialization.Metadata.JsonTypeInfo.GetConverter(Type, Type, MemberInfo, Type&, JsonSerializerOptions) + 0x58
at System.Text.Json.JsonSerializerOptions.<RootBuiltInConvertersAndTypeIn
What does' 2 stand for, this grammar does not understand
It is arity of the generic type. For example, generic type with two arguments is going to have `2 appended to its name.
I only know that it represents 2 parameters, but I only know this information and do not know how to solve the error I mentioned above. The main reason is that the class prompted by this error is not written by me, which is too complicated for me. you can give several examples?, such as how to write the one above. thank you
my code is f__AnonymousType6
It's anonymous. How do I write code so that it's not anonymous
So what does mscorlib mean?
@jkotas The grammar have learned to write, I try to use [JsonSerializable (typeof (Swashbuckle. AspNetCore. SwaggerUI. ModelRendering []))] to solve a problem, And using rd., XML has solved the System. Text.. Json Serialization. Converters. SmallObjectWithParameterizedConstructorConverter, but prompt method didn't find now, Thank you. I'll keep trying
@heppth can you help me my error is
Connection id "0HMLDPGDK1NPD", Request id "0HMLDPGDK1NPD:00000002": An unhandled exception was thrown by the application. System.Reflection.MissingMetadataException: 'System.Text.Json.Serialization.Converters.SmallObjectWithParameterizedConstructorConverter<<>f__AnonymousType6<System.Int32,System.Int32,System.String>,System.Int32,System.Int32,System.String,System.Object>' is missing metadata. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=392859 at System.Reflection.Runtime.General.TypeUnifier.WithVerifiedTypeHandle(RuntimeConstructedGenericTypeInfo, RuntimeTypeInfo[]) + 0x8f at System.Text.Json.Serialization.Converters.ObjectConverterFactory.CreateConverter(Type, JsonSerializerOptions) + 0x1e9 at System.Text.Json.Serialization.JsonConverterFactory.GetConverterInternal(Type, JsonSerializerOptions) + 0x15 at System.Text.Json.JsonSerializerOptions.GetConverterInternal(Type) + 0x21c at System.Text.Json.JsonSerializerOptions.DetermineConverter(Type, Type, MemberInfo) + 0x92 at System.Text.Json.Serialization.Metadata.JsonTypeInfo.GetConverter(Type, Type, MemberInfo, Type&, JsonSerializerOptions) + 0x58 at System.Text.Json.JsonSerializerOptions.<RootBuiltInConvertersAndTypeIn
<Type Name="System.Text.Json.Serialization.Converters.EnumConverter`1[[Swashbuckle.AspNetCore.SwaggerUI.ModelRendering,Swashbuckle.AspNetCore.SwaggerUI]]" Dynamic="Required All" />
I have resolved this error
why MyJsonContext Method is not found
namespace api.aot
{
//https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation?pivots=dotnet-7-0#source-generation-support-in-aspnet-core
//[JsonSerializable(typeof(JsonResult[]))]
//[JsonSerializable(typeof(VersionModel))]
[JsonSerializable(typeof(JSONResultInfo))]
[JsonSerializable(typeof(VersionModel))]
[JsonSerializable(typeof(Swashbuckle.AspNetCore.SwaggerUI.ModelRendering[]))]
internal partial class MyJsonContext : JsonSerializerContext { }
}
ebRootPath:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.MissingMethodException: Method not found: 'Void System.Text.Json.Serialization.JsonSerializerContext..ctor(System.Text.Json.JsonSerializerOptions)'.
at Internal.Runtime.TypeLoaderExceptionHelper.CreateMissingMethodException(ExceptionStringID, String) + 0x40
at Internal.Runtime.CompilerHelpers.ThrowHelpers.ThrowMissingMethodException(ExceptionStringID, String) + 0x9
at webapi_mes.api.aot.MyJsonContext..ctor() + 0x15
at System.Activator.CreateInstance[T]() + 0x3d
--- End of inner exception stack trace ---
at System.Activator.CreateInstance[T]() + 0xbb
at System.Text.Json.JsonSerializerOptions.AddContext[TContext]() + 0x25
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String) + 0x6d
at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value() + 0xa4
at Microsoft.AspNetCore.Mvc.MvcCoreMvcOptionsSetup.Configure(MvcOptions) + 0x2c1
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String) + 0x92
at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value() + 0xa4
Too much warning This is a troublesome problem
t be removed, use strong type references like 'RSA.Create()' instead. [D:\dev\testproject\webapi
_mes\aaa.csproj]
ILC : Trim analysis warning IL2026: System.Security.Cryptography.Xml.RSAPKCS1SignatureDescription.CreateFormatter(Asymm
etricAlgorithm): Using method 'System.Security.Cryptography.CryptoConfig.CreateFromName(String)' which has 'RequiresUnr
eferencedCodeAttribute' can break functionality when trimming application code. The default algorithm implementations m
ight be removed, use strong type references like 'RSA.Create()' instead. [D:\dev\testproject\webapi_m
es\aaa.csproj]
C:\Users\物是人非\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\6.0.10\runtimes\win-x64\lib\net6.0\Microsoft.AspNe
tCore.DataProtection.dll : warning IL9702: Assembly 'Microsoft.AspNetCore.DataProtection' produced AOT analysis warning
s. [D:\dev\testproject\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-rc.1.21420.1\framework\System.Data.Common
.dll : warning IL9702: Assembly 'System.Data.Common' produced AOT analysis warnings. [D:\dev\company_project\sotrun_web
api\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\6.0.10\runtimes\win-x64\lib\net6.0\System.Diagnost
ics.EventLog.dll : warning IL9702: Assembly 'System.Diagnostics.EventLog' produced AOT analysis warnings. [D:\dev\compa
ny_project\sotrun_webapi\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-rc.1.21420.1\framework\System.Reflection.
DispatchProxy.dll : warning IL9702: Assembly 'System.Reflection.DispatchProxy' produced AOT analysis warnings. [D:\dev\
testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/DataContractSerializerOperationFormatter.cs(506):
Trim analysis warning IL2026: System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParam
eter(XmlDictionaryReader,PartInfo,Boolean): Using method 'System.Runtime.Serialization.XmlObjectSerializer.IsStartObjec
t(XmlDictionaryReader)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application
code. Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sur
e all of the required types are preserved. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/DataContractSerializerOperationFormatter.cs(482):
Trim analysis warning IL2026: System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParam
eters(XmlDictionaryReader,PartInfo[],Object[],Boolean): Using method 'System.Runtime.Serialization.XmlObjectSerializer.
IsStartObject(XmlDictionaryReader)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming
application code. Data Contract Serialization and Deserialization might require types that cannot be statically analyz
ed. Make sure all of the required types are preserved. [D:\dev\testproject\aaa\aaa.cspr
oj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/XmlSerializerOperationFormatter.cs(460): Trim ana
lysis warning IL2026: System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReade
r,MessageVersion,XmlSerializer,MessagePartDescription,MessagePartDescriptionCollection,Object[],Boolean): Using method
'System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader,String)' which has 'RequiresUnreferencedCodeAttribute' ca
n break functionality when trimming application code. Members from deserialized types may be trimmed if not referenced
directly. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/XmlSerializerOperationFormatter.cs(390): Trim ana
lysis warning IL2026: System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter,
MessageVersion,XmlSerializer,MessagePartDescription,MessagePartDescriptionCollection,Object,Object[]): Using method 'Sy
stem.Xml.Serialization.XmlSerializer.Serialize(XmlWriter,Object,XmlSerializerNamespaces)' which has 'RequiresUnreferenc
edCodeAttribute' can break functionality when trimming application code. Members from serialized types may be trimmed i
f not referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Security/WSTrust.cs(920): Trim analysis warning IL2026: Syst
em.ServiceModel.Security.WSTrust.Driver.WriteAppliesTo(Object,Type,XmlObjectSerializer,XmlWriter): Using method 'System
.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter,Object)' which has 'RequiresUnreferencedCode
Attribute' can break functionality when trimming application code. Data Contract Serialization and Deserialization migh
t require types that cannot be statically analyzed. Make sure all of the required types are preserved. [D:\dev\company_
project\sotrun_webapi\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/DataContractSerializerOperationFormatter.cs(291):
Trim analysis warning IL2026: System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParamet
erPart(XmlDictionaryWriter,PartInfo,Object): Using method 'System.Runtime.Serialization.XmlObjectSerializer.WriteObject
(XmlDictionaryWriter,Object)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming appli
cation code. Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Ma
ke sure all of the required types are preserved. [D:\dev\testproject\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-rc.1.21420.1\framework\System.Linq.Querya
ble.dll : warning IL9702: Assembly 'System.Linq.Queryable' produced AOT analysis warnings. [D:\dev\company_project\sotr
un_webapi\aaa\aaa.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataTable.cs(6726): Trim analysis warning IL2026: System.Data.DataT
able.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader): Using method 'System.Data.DataTable.ReadXmlSerializa
bleInternal(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. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataSet.cs(3493): Trim analysis warning IL2026: System.Data.DataSet
.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader): Using method 'System.Data.DataSet.ReadXmlSerializableInt
ernal(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 trim
med if not referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-rc.1.21420.1\framework\System.Private.Dat
aContractSerialization.dll : warning IL9702: Assembly 'System.Private.DataContractSerialization' produced AOT analysis
warnings. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Description/XmlSerializerOperationBehavior.cs(832): Trim ana
lysis warning IL2026: System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.XmlSerializerImporter.In
cludeType(Type,Boolean): Using method 'System.Xml.Serialization.SoapReflectionImporter.IncludeType(Type)' which has 'Re
quiresUnreferencedCodeAttribute' can break functionality when trimming application code. Members from serialized types
may be trimmed if not referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Description/XmlSerializerOperationBehavior.cs(836): Trim ana
lysis warning IL2026: System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.XmlSerializerImporter.In
cludeType(Type,Boolean): Using method 'System.Xml.Serialization.XmlReflectionImporter.IncludeType(Type)' which has 'Req
uiresUnreferencedCodeAttribute' can break functionality when trimming application code. Members from serialized types m
ay be trimmed if not referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-rc.1.21420.1\framework\System.Formats.Asn
1.dll : warning IL9702: Assembly 'System.Formats.Asn1' produced AOT analysis warnings. [D:\dev\company_project\sotrun_w
ebapi\aaa\aaa.csproj]
/_/src/libraries/System.Private.CoreLib/src/System/Resources/ManifestBasedResourceGroveler.cs(238): Trim analysis warni
ng IL2026: System.Resources.ManifestBasedResourceGroveler.CreateResourceSet(Stream,Assembly): Using method 'System.Reso
urces.ManifestBasedResourceGroveler.InternalGetResourceSetFromSerializedData(Stream,String,String,ResourceManagerMediat
or)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The CustomRe
sourceTypesSupport feature switch has been enabled for this app which is being trimmed. Custom readers as well as custo
m objects on the resources file are not observable by the trimmer and so required assemblies, types and members may be
removed. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs(32): Trim analysis
warning IL2026: System.Xml.Serialization.ReflectionXmlSerializationReader..cctor(): Using method 'System.Xml.Serializa
tion.TypeScope.GetTypeDesc(Type)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming a
pplication code. calls GetTypeDesc. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs(33): Trim analysis
warning IL2026: System.Xml.Serialization.ReflectionXmlSerializationReader..cctor(): Using method 'System.Xml.Serializa
tion.TypeScope.GetTypeDesc(Type)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming a
pplication code. calls GetTypeDesc. [D:\dev\testproject\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-rc.1.21420.1\framework\System.Private.Xml
.dll : warning IL9702: Assembly 'System.Private.Xml' produced AOT analysis warnings. [D:\dev\company_project\sotrun_web
api\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/DataContractSerializerOperationFormatter.cs(657):
Trim analysis warning IL2026: System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObj
ect(XmlDictionaryReader,XmlObjectSerializer): Using method 'System.Runtime.Serialization.XmlObjectSerializer.ReadObject
(XmlDictionaryReader,Boolean)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming appl
ication code. Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. M
ake sure all of the required types are preserved. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Dispatcher/DataContractSerializerOperationFormatter.cs(660):
Trim analysis warning IL2026: System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObj
ect(XmlDictionaryReader,XmlObjectSerializer): Using method 'System.Linq.Queryable.AsQueryable(IEnumerable)' which has '
RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Enumerating in-memory collec
tions as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get
rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to
fail at runtime. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataTable.cs(6742): Trim analysis warning IL2026: System.Data.DataT
able.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter): Using method 'System.Data.DataTable.WriteXmlInterna
l(XmlWriter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Dat
aTable.WriteXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimm
ed if not referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataSet.cs(3513): Trim analysis warning IL2026: System.Data.DataSet
.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter): Using method 'System.Data.DataSet.WriteXmlInternal(XmlW
riter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataSet.W
riteXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimmed if no
t referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Description/XmlSerializerOperationBehavior.cs(805): Trim ana
lysis warning IL2026: System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.XmlSerializerImporter.Im
portTypeMapping(Type,Boolean): Using method 'System.Xml.Serialization.SoapReflectionImporter.ImportTypeMapping(Type)' w
hich has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Members from seria
lized types may be trimmed if not referenced directly. [D:\dev\testproject\aaa\aaa.cspr
oj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Description/XmlSerializerOperationBehavior.cs(809): Trim ana
lysis warning IL2026: System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.XmlSerializerImporter.Im
portTypeMapping(Type,Boolean): Using method 'System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type)' wh
ich has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Members from serial
ized types may be trimmed if not referenced directly. [D:\dev\testproject\aaa\aaa.cspro
j]
C:\Users\物是人非\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-rc.1.21420.1\framework\Microsoft.CSharp.d
ll : warning IL9702: Assembly 'Microsoft.CSharp' produced AOT analysis warnings. [D:\dev\testproject\
aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Description/XmlSerializerOperationBehavior.cs(781): Trim ana
lysis warning IL2026: System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.XmlSerializerImporter.Im
portMembersMapping(XmlName,String,XmlReflectionMember[],Boolean,Boolean,Boolean,String): Using method 'System.Xml.Seria
lization.SoapReflectionImporter.ImportMembersMapping(String,String,XmlReflectionMember[],Boolean,Boolean)' which has 'R
equiresUnreferencedCodeAttribute' can break functionality when trimming application code. Members from serialized types
may be trimmed if not referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Description/XmlSerializerOperationBehavior.cs(785): Trim ana
lysis warning IL2026: System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.XmlSerializerImporter.Im
portMembersMapping(XmlName,String,XmlReflectionMember[],Boolean,Boolean,Boolean,String): Using method 'System.Xml.Seria
lization.XmlReflectionImporter.ImportMembersMapping(String,String,XmlReflectionMember[],Boolean,Boolean)' which has 'Re
quiresUnreferencedCodeAttribute' can break functionality when trimming application code. Members from serialized types
may be trimmed if not referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Description/XmlSerializerOperationBehavior.cs(1280): Trim an
alysis warning IL2026: System.ServiceModel.Description.XmlSerializerHelper.FromMappingsViaInjection(XmlMapping[],Type):
Using method 'System.Xml.Serialization.XmlSerializer.XmlSerializer(Type)' which has 'RequiresUnreferencedCodeAttribute
' can break functionality when trimming application code. Members from serialized types may be trimmed if not reference
d directly. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Description/XmlSerializerOperationBehavior.cs(1285): Trim an
alysis warning IL2026: System.ServiceModel.Description.XmlSerializerHelper.FromMappingsViaInjection(XmlMapping[],Type):
Using method 'System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[],Type)' which has 'RequiresUnreferencedC
odeAttribute' can break functionality when trimming application code. Members from serialized types may be trimmed if n
ot referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/System.Private.ServiceModel/src/System/ServiceModel/Description/XmlSerializerOperationBehavior.cs(1262): Trim an
alysis warning IL2026: System.ServiceModel.Description.XmlSerializerHelper.FromMappingsViaReflection(XmlMapping[],Type)
: Using method 'System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[],Type)' which has 'RequiresUnreferenced
CodeAttribute' can break functionality when trimming application code. Members from serialized types may be trimmed if
not referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-rc.1.21420.1\framework\System.Diagnostics
.DiagnosticSource.dll : warning IL9702: Assembly 'System.Diagnostics.DiagnosticSource' produced AOT analysis warnings.
[D:\dev\testproject\aaa\aaa.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataTable.cs(6689): Trim analysis warning IL2026: System.Data.DataT
able.System.Xml.Serialization.IXmlSerializable.GetSchema(): Using method 'System.Data.DataTable.GetXmlSchema()' which h
as '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 trimm
ed if not referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
/_/src/libraries/System.Data.Common/src/System/Data/DataSet.cs(3461): Trim analysis warning IL2026: System.Data.DataSet
.System.Xml.Serialization.IXmlSerializable.GetSchema(): Using method 'System.Data.DataSet.WriteXmlSchema(DataSet,XmlWri
ter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataSet.Get
Schema uses TypeDescriptor and XmlSerialization underneath which are not trimming safe. Members from serialized types m
ay be trimmed if not referenced directly. [D:\dev\testproject\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-rc.1.21420.1\framework\System.ComponentMo
del.TypeConverter.dll : warning IL9702: Assembly 'System.ComponentModel.TypeConverter' produced AOT analysis warnings.
[D:\dev\testproject\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-rc.1.21420.1\framework\System.Private.Dat
aContractSerialization.dll : warning IL2104: Assembly 'System.Private.DataContractSerialization' produced trim warnings
. For more information see https://aka.ms/dotnet-illink/libraries [D:\dev\testproject\aaa\weba
pi_mes.csproj]
ILC : AOT analysis warning IL1005: aaa.api.aot.MyJsonContext.MyJsonContext(): Method will always throw because:
Missing method 'Void System.Text.Json.Serialization.JsonSerializerContext..ctor(System.Text.Json.JsonSerializerOptions)
' [D:\dev\testproject\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\6.0.10\runtimes\win-x64\lib\net6.0\Microsoft.AspNe
tCore.Server.Kestrel.Transport.Quic.dll : warning IL9702: Assembly 'Microsoft.AspNetCore.Server.Kestrel.Transport.Quic'
produced AOT analysis warnings. [D:\dev\testproject\aaa\aaa.csproj]
C:\Users\物是人非\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x64\6.0.10\runtimes\win-x64\lib\net6.0\System.Security
.Cryptography.Pkcs.dll : warning IL9702: Assembly 'System.Security.Cryptography.Pkcs' produced AOT analysis warnings. [
D:\dev\testproject\aaa\aaa.csproj]
ILC : AOT analysis warning IL1005: aaa.api.aot.MyJsonContext.JSONResultInfoPropInit(JsonSerializerContext): Meth
od will always throw because: Failed to load type 'System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues`1' fr
om assembly 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' [D:\dev\company_proje
ct\sotrun_webapi\aaa\aaa.csproj]
ILC : AOT analysis warning IL1005: aaa.api.aot.MyJsonContext.VersionModelPropInit(JsonSerializerContext): Method
will always throw because: Failed to load type 'System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues`1' from
assembly 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' [D:\dev\company_project
\sotrun_webapi\aaa\aaa.csproj]
ILC : AOT analysis warning IL1005: aaa.api.aot.MyJsonContext.MyJsonContext(JsonSerializerOptions): Method will a
lways throw because: Missing method 'Void System.Text.Json.Serialization.JsonSerializerContext..ctor(System.Text.Json.J
sonSerializerOptions)' [D:\dev\testproject\aaa\aaa.csproj]
ILC : AOT analysis warning IL1005: aaa.api.aot.SourceGenerationContext.UrlDescriptorPropInit(JsonSerializerConte
xt): Method will always throw because: Failed to load type 'System.Text.Json.Serialization.Metadata.JsonPropertyInfoVal
ues`1' from assembly 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' [D:\dev\comp
any_project\sotrun_webapi\aaa\aaa.csproj]
ILC : AOT analysis warning IL1005: aaa.api.aot.SourceGenerationContext.SourceGenerationContext(): Method will al
ways throw because: Missing method 'Void System.Text.Json.Serialization.JsonSerializerContext..ctor(System.Text.Json.Js
onSerializerOptions)' [D:\dev\testproject\aaa\aaa.csproj]
ILC : AOT analysis warning IL1005: aaa.api.aot.SourceGenerationContext.SourceGenerationContext(JsonSerializerOpt
ions): Method will always throw because: Missing method 'Void System.Text.Json.Serialization.JsonSerializerContext..cto
r(System.Text.Json.JsonSerializerOptions)' [D:\dev\testproject\aaa\aaa.csproj]
ILC : AOT analysis warning IL1005: aaa.api.aot.SerializationModeOptionsContext.get_ListInt32(): Method will alwa
ys throw because: Failed to load type 'System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues`1' from assembl
y 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' [D:\dev\company_project\sotrun_
webapi\aaa\aaa.csproj]
ILC : AOT analysis warning IL1005: aaa.api.aot.SerializationModeOptionsContext.SerializationModeOptionsContext(J
sonSerializerOptions): Method will always throw because: Missing method 'Void System.Text.Json.Serialization.JsonSerial
izerContext..ctor(System.Text.Json.JsonSerializerOptions)' [D:\dev\testproject\aaa\aaa.
csproj]
ILC : AOT analysis warning IL1005: aaa.api.aot.SerializationModeOptionsContext.SerializationModeOptionsContext()
: Method will always throw because: Missing method 'Void System.Text.Json.Serialization.JsonSerializerContext..ctor(Sys
tem.Text.Json.JsonSerializerOptions)' [D:\dev\testproject\aaa\aaa.csproj]
Hi,
just compiled a complex web application natively. Everything is working perfectly except Swashbuckle. I am not shure how to fix it. This is the exception:
I tried this, but withoug success