handzlikchris / handzlikchris/FastScriptReload

There is an issue accessing internal variables at runtime.

Ouverte
#147 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C#
Étoiles
2.2k
Forks
167
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Start by comparing the modified Assembly-Csharp.dll in ajustDll with the runtime Assembly-CSharp.dll in Library/ScriptAssemblies, then inspect how patch assemblies are generated. Review the proposed AssemblyInfo.cs and InternalsVisibleTo entries; done means generated Assembly-CSharp_Patch_0 through Assembly-CSharp_Patch_N assemblies can access internal variables at runtime.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp, unity
Domaine
devtools, game-dev
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.