Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

There is an issue accessing internal variables at runtime.

Đang mở
#147 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
csharp, unity
Lĩnh vực
devtools, game-dev

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của handzlikchris/FastScriptReload

Tất cả issue của handzlikchris/FastScriptReload

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.