Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Unity Engine 2022 causes C# compilation errors.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
gir489
Grandmaster Cheater
Reputation: 14

Joined: 03 Jan 2012
Posts: 841
Location: Maryland, United States

PostPosted: Fri Oct 27, 2023 8:48 am    Post subject: Unity Engine 2022 causes C# compilation errors. Reply with quote

I am testing my table against the Valheim beta which has recently updated to Unity 2022. When attempting to call compileCS against it, I get the following error:

Compilation error:XX - The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=SomeBullshitHexThatImNotGonnaTypeOut'.

I googled the error, and in typical .NET environments, the solution is to add the newer runtime it wants to the build, but I don't think I can do that within the cheat engine script.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25785
Location: The netherlands

PostPosted: Fri Oct 27, 2023 9:55 am    Post subject: Reply with quote

Code:

compileCS(text, {references}, coreAssembly OPTIONAL)


the 3th parameter lets you specify which runtime to use. Is there perhaps a different .NET base file in the install path that fits better ? (CE just guesses otherwise based on the loaded modules)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
gir489
Grandmaster Cheater
Reputation: 14

Joined: 03 Jan 2012
Posts: 841
Location: Maryland, United States

PostPosted: Fri Oct 27, 2023 10:37 am    Post subject: Reply with quote

Dark Byte wrote:
Code:

compileCS(text, {references}, coreAssembly OPTIONAL)


the 3th parameter lets you specify which runtime to use. Is there perhaps a different .NET base file in the install path that fits better ? (CE just guesses otherwise based on the loaded modules)

Yeah which is what it's doing?

It's using D:\SteamLibrary\steamapps\common\Valheim\valheim_Data\Managed\netstandard.dll which is the library it's complaining about. It's using dotnetpatch_getAllReferences() to resolve that file. When I load netstandard.dll into DnSpy, it says its version is 2.1.0.0. There's 2 compileCS calls, one with the sysfile and one without. The one without causes the aformentioned error. With it, it just complains System.Object is not defined or imported.

Here is my script:

Code:
local references, sysfile=dotnetpatch_getAllReferences() --you're free to build your own list
local csfile,msg=compileCS(csharpscript, references, sysfile)

if csfile==nil then
  --sometimes having the sysfile causes an issue. Try without
  csfile,msg=compileCS(csharpscript, references)
  if csfile==nil then
    if msg==nil then msg=' (?Unknown error?)' end
    messageDialog('Compilation error:'..msg, mtError, mbOK) --show compile error in a dialog instead of a lua error only
    error(msg)
  end
end


I think it's just the same thing the auto hijacker does from the template.

EDIT: I had to supply it System.Core.dll from the Managed folder. Works now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites