There is an issue accessing internal variables at runtime.
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
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách so sánh Assembly-Csharp.dll đã sửa đổi trong ajustDll với Assembly-CSharp.dll của runtime trong Library/ScriptAssemblies, sau đó kiểm tra cách các patch assembly được tạo. Xem lại AssemblyInfo.cs được đề xuất và các mục InternalsVisibleTo; hoàn thành có nghĩa là các assembly Assembly-CSharp_Patch_0 đến Assembly-CSharp_Patch_N được tạo có thể truy cập các biến internal trong runtime.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Although a copy of the original assembly Assembly-Csharp.dll is located in the ajustDll folder and has been modified to make the patch assembly is a friend assembly to patch, allowing the patch assembly to compile with access to internal variables in Assembly-Csharp, the actual assembly running is not the DLL under the ajustdll folder but rather Assembly-CSharp.dll in Library/ScriptAssemblies. Therefore, accessing internal variables at runtime will cause issues.
I thought of a solution: adding a file named AssemblyInfo.cs to the project with the following content:
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Assembly-CSharp_Patch_0")]
[assembly: InternalsVisibleTo("Assembly-CSharp_Patch_1")]
[assembly: InternalsVisibleTo("Assembly-CSharp_Patch_2")]
[assembly: InternalsVisibleTo("Assembly-CSharp_Patch_3")]
[assembly: InternalsVisibleTo("Assembly-CSharp_Patch_4")]
[assembly: InternalsVisibleTo("Assembly-CSharp_Patch_5")]
...
[assembly: InternalsVisibleTo("Assembly-CSharp_Patch_N")]
This way, during runtime, the generated patch file names will be Assembly-CSharp_Patch_0 to Assembly-CSharp_Patch_N, which will allow the patch assembly to access the internal variables in Assembly-Csharp with the proper permissions.
- Ngôn ngữ chính
- C#
- Star
- 2.2k
- Fork
- 167
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
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 handzlikchris/FastScriptReload
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
handzlikchris/FastScriptReload#202 · 2 reaction ·
-
csc.rsp support Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Failed to find entry-points Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
handzlikchris/FastScriptReload#203 · 4 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
handzlikchris/FastScriptReload#197 · 1 bình luận ·
Tất cả issue của handzlikchris/FastScriptReload
Issue tương tự
-
effort:S P3 refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
C#/.NET Roslyn LSP Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Suspicious code fragments Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
DotNetNext/SqlSugar#1458 ·