@MichalStrehovsky : now that it is possible with .NET 8 to run both the kestrel server and npgsql in reflection free mode (see https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/CSharp/appmpower) I am trying to close my last open item, running the sqlclient in:
- either reflection free mode: the first blocking factor here seems to be the missing option for flags something like
<RuntimeHostConfigurationOption Include="Switch.System.Reflection.Disabled.DoNotThrowForAttributeFlags" Value="true" />
Unhandled Exception: MT4340638104: TypeInitialization_Type_NoTypeAvailable
---> MT4340635080: Reflection_Disabled
at Internal.Reflection.RuntimeTypeInfo.GetAttributeFlagsImpl() + 0x34
This has been reported in other issues and I have seen that was omitted for a better way of dealing with reflection; would still be nice however to have this one
- or a way to exclude the System.Data.SqlClient from the reflection free mode, so having a custom library in a reflection free mode using System.Data.SqlClient with reflection. You earlier pointed me to the following solution, but I wonder whether it is still working (and if so how I can test that the custom library is reflection free):
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.All)]
internal class __BlockAllReflectionAttribute : Attribute { }
}
The goal here is purily obfuscation, where I don't mind having open source libraries un-obfuscated, but like to have some of my libraries obfuscated (reflection free).
First step I would like to get working is:
using var sqlConnection = new SqlConnection("...");
sqlConnection.Open();
Console.WriteLine("state: " + sqlConnection.State);
sqlConnection.Close();
@MichalStrehovsky : now that it is possible with .NET 8 to run both the kestrel server and npgsql in reflection free mode (see https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/CSharp/appmpower) I am trying to close my last open item, running the sqlclient in:
This has been reported in other issues and I have seen that was omitted for a better way of dealing with reflection; would still be nice however to have this one
The goal here is purily obfuscation, where I don't mind having open source libraries un-obfuscated, but like to have some of my libraries obfuscated (reflection free).
First step I would like to get working is: