Hi,
.NET 9
LLBL 5.11.3
I am trying to use AoT compilation in my lambda project. After setting <PublishAot>true<PublishAoT> in csproj and deploying app I get an error:
Unhandled exception. SD.LLBLGen.Pro.ORMSupportClasses.ORMGeneralOperationException: The property name 'NpgsqlDbType' is unknown on the parameter class in the assembly 'Npgsql, Version=9.0.2.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'
at SD.LLBLGen.Pro.ORMSupportClasses.DbProviderFactoryInfo.InitializeSpecificDbTypeCache() + 0x31e
at SD.LLBLGen.Pro.DQE.PostgreSql.DynamicQueryEngine.Configure(PostgreSqlDQEConfiguration) + 0x153
at Program.<Main>$(String[] args) + 0xf1
The only way to resolve this issue is adding in csproj:
<ItemGroup>
<TrimmerRootAssembly Include="Npgsql" />
</ItemGroup>
but I don't want to set Npgsql library as root assembly because my application size is bigger when I do it.
The problem probably occurs because, in class DbProviderFactoryInfo, in method InitializeSpecificDbTypeCache (line 243) reflection is used.
Code that I use to configure a database:
RuntimeConfiguration.ConfigureDQE<PostgreSqlDQEConfiguration>(c =>
c.SetTraceLevel(Debugger.IsAttached ? TraceLevel.Verbose : TraceLevel.Off)
.AddDbProviderFactory(typeof(NpgsqlFactory)));
How can I resolve this problem without using TrimmerRootAssembly?