[2.x] Warnings when `PublishAot` is enabled.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start in Silk.NET.Core.Loader.DefaultPathResolver, where the warnings identify Assembly.Location, Assembly.CodeBase, and DependencyContext.Default usage. Reproduce with a small .NET 10 project using PublishAot=true and Vk.GetApi(), then trace the resolver paths that trigger the warnings. Done means AOT publishing no longer emits the reported warnings while native library loading continues to work.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Silk.NET library loader generates warnings when AoT is enabled. Everything works at runtime with AOT, but warnings are reported and cannot be easily supressed.
Steps to reproduce
- Platform: Any (tested on Windows 11)
- Dotnet: v10.0.x
- Create a new dotnet project with
<PublishAot>true</PublishAot> - Add one single line:
using var vk = Vk.GetApi();. It fails with anyFoo.GetApi()call, not only with Vulkan. - You get the following warnings:
jhmci@CIBERMAN-PC MINGW64 /c/repos/open-source/silk-aot-repro
$ dotnet publish -c Release -r win-x64 -p:PublishAot=true
Restore complete (0.5s)
SilkAotRepro net10.0 win-x64 succeeded with 6 warning(s) (9.0s) → bin\Release\net10.0\win-x64\publish\
ILC : warning IL3000: Silk.NET.Core.Loader.DefaultPathResolver.<>c.<.cctor>b__24_3(String): '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'.
ILC : warning IL3002: Silk.NET.Core.Loader.DefaultPathResolver.<>c.<.cctor>b__24_3(String): Using member 'System.Reflection.Assembly.CodeBase.get' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. This member throws an exception for assemblies embedded in a single-file app.
ILC : warning IL3002: Silk.NET.Core.Loader.DefaultPathResolver.TryLocateNativeAssetFromDeps(String,String&,String&): Using member 'Microsoft.Extensions.DependencyModel.DependencyContext.Default.get' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. DependencyContext for an assembly from a application published as single-file is not supported. The method will return null. Make sure the calling code can handle this case.
ILC : warning IL3000: Silk.NET.Core.Loader.DefaultPathResolver.TryLocateNativeAssetFromDeps(String,String&,String&): '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'.
ILC : warning IL3002: Silk.NET.Core.Loader.DefaultPathResolver.TryLocateNativeAssetInRuntimesFolder(String,String,String&): Using member 'Microsoft.Extensions.DependencyModel.DependencyContext.Default.get' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. DependencyContext for an assembly from a application published as single-file is not supported. The method will return null. Make sure the calling code can handle this case.
ILC : warning IL3002: Microsoft.Extensions.DependencyModel.DependencyContext..cctor(): Using member 'Microsoft.Extensions.DependencyModel.DependencyContext.LoadDefault()' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. DependencyContext for an assembly from a application published as single-file is not supported. The method will return null. Make sure the calling code can handle this case.
Build succeeded with 6 warning(s) in 10.4s
Comments
Add any other context about the problem here.
If you know how to fix this issue, please submit a pull request instead!
- Ngôn ngữ chính
- C#
- Star
- 5.3k
- Fork
- 484
- Merge trung bình
- 1 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotnet/Silk.NET
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 40/100
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Tất cả issue của dotnet/Silk.NET
Issue tương tự
-
bug effort:S P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
nightscout/nocturne#3093 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add dependency list in documentsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Add 'upm' tag on githubĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100