FastReport Not supper .NET9.0 PublishAot
Describe the bug Using .NET9.0 AOT to compile into a library, there was an error when calling Java/C #
To Reproduce
Stacktrace Unhandled exception. System.MissingMethodException: No parameterless constructor defined for type 'FastReport.ReportPage'. at System.ActivatorImplementation.CreateInstance(Type, Boolean) + 0x176 at FastReport.Utils.FRReader.Read() + 0x1c7 at FastReport.Base.DeserializeSubItems(FRReader) + 0x17 at FastReport.Base.Deserialize(FRReader) + 0x42 at FastReport.Report.Deserialize(FRReader) + 0x74 at FastReport.Utils.FRReader.Read(IFRSerializable) + 0x99 at FastReport.Report.Load(Stream) + 0x150 at FastReport.Report.Load(String) + 0x80
Device (please complete the following information):
- OS: win11
- Version 2025.1.0
Discovered that the error was caused here:FastReport/FastReport.Base/Utils/FRReader.cs Read() result = Activator.CreateInstance(type) as IFRSerializable; not supported
Hello!
Thank you for your appeal!
Could you please send a problematic application to reproduce this error
Best regards, Bogdan
Temporary solution:
<ItemGroup>
<RdXmlFile Include="rd.xml" />
</ItemGroup>
rd.xml:
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<Assembly Name="FastReport" Dynamic="Required All"/>
</Application>
</Directives>
Hello!
Thank you for your appeal!
Could you please send a problematic application to reproduce this error
Best regards, Bogdan
This is a problematic application:https://github.com/qwertzou/FastReport.NET9.AOT.DEMO
Hello!
I send you an example of the built library below
Best regards, Bogdan
I'm sorry, maybe I didn't express the problem clearly Please try using the command to publish: dotnet publish -c Release -r win-x86 /p:PublishAot=true
Regarding NET NativeAOT, please see here https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=windows%2Cnet8
I am sending you the test application below.
https://www.dropbox.com/scl/fi/4kbswm7gisjts3d87svak/Test.zip?rlkey=1e3yui365tay3wq1cp4q8f19q&st=o6b39nda&dl=0
Best regards, Bogdan
I am sending you the test application below.
https://www.dropbox.com/scl/fi/4kbswm7gisjts3d87svak/Test.zip?rlkey=1e3yui365tay3wq1cp4q8f19q&st=o6b39nda&dl=0
Best regards, Bogdan
Thank you for your reply. I have downloaded and tested your testing application, and the problem has occurred
I created a task based on your request and sent it to the development department. As soon as there are changes, we will notify you immediately.
Best regards, Bogdan
Hello!
For the FastReport library to work correctly, it must be added to the trimming exception.
I am sending you the test project below.
Best regards, Bogdan