Garuda/Eagle in starpack
Not logged in
This forum is sponsored by Mistachkin Systems.
Eagle: Secure Software Automation
Thank you for the advice.
I looked into the details by your instruction.

I sent the necessary files to your mail address.

Because the wrapped script failed but the unwrapped script was successful, I compared the differences.

Before explaining it, there should be a special consideration for GRPC behavior.
I'm not sure of the detailed reason but if I set AssemblyResolve delegate to my unwrapped script version, an exception is thrown saying UnityEngine.dll is missing. I don't have UnityEngine.dll The reason is explained in this post. https://github.com/grpc/grpc/issues/20251

Anyway, I had to remove the AssemblyResolve delegate. Only the wrapped script has AssemblyResolve delegate.

The unwrapped script loads all the necessary assemblies when they are needed (lazy loading?). I checked it by calling [object assemblies]. But it was not enough. I checked the loaded DLLs by LockHunter. https://lockhunter.com/

At this I concluded that the following assemblies under GRPCRemoteClient folder are loaded to wish.exe (which sources the unwrapped script.)


```
Google.Protobuf.dll
Grpc.Core.dll
Grpc.Core.Api.dll
GRPCRemoteClient.dll
System.Memory.dll
System.Runtime.CompilerServices.Unsafe.dll
grpc_csharp_ext.x86.dll

```

The last one grpc_csharp_ext.x86.dll ​is a native DLL not a managed DLL.

So I tried somehow to load the same DLLs from the wrapped script.
The following two assemblies are loaded by AssemblyResolve delegate.

```
Google.Protobuf.dll
Grpc.Core.Api.dll
```

LockHunter says only the following assemblies were loaded.


```
Google.Protobuf.dll
Grpc.Core.Api.dll
GRPCRemoteClient.dll
```

In order to load the rest of the assemblies, I explicitly called [object load -loadtype File $dll_path].
I could load them.

```
Grpc.Core.dll
System.Memory.dll
System.Runtime.CompilerServices.Unsafe.dll

```

Regarding the DLLs loaded to the memory, the difference between the unwrapped and wrapped versions is only one.

```
grpc_csharp_ext.x86.dll
```

This native DLL was not loaded. This DLL is referenced by Grpc.Core.dll (I grepped the binary data as text.)
But it seems this managed assembly doesn't load it. For now, I believe this is the problem.

I also tried copying all DLLs to the same folder as the executable but the result was the same.