c# - IL2CPP Compiler Runtime Errors for Unity3D iOS 64-bit -
i have unity3d mobile chess app porting 32-bit 64-bit unity 3d 4.6.5f1. it's using opengls2.0, .net 2.0 libraries, , universal binaries being generated.
i getting runtime error in debugger says following:
nullreferenceexception: null value found object instance required. @ <privateimplementationdetails>..ctor () [0x00000] in <filename unknown>:0 @ valilscriptobject.update () [0x00000] in <filename unknown>:0 @ system.collections.generic.dictionary`2+shimenumerator[boo.lang.runtime.dynamicdispatching.dispatcherkey,boo.lang.runtime.dynamicdispatching.dispatcher].get_current () [0x00000] in <filename unknown>:0 system.collections.generic.shimenumerator:get_current()
(filename: not available on il2cpp line: 4294967295)
it compiles fine using mono 2.0 port il2cpp 64-bit universal binary throws error.
the function it's referencing update() appears fine.
void update () { if(request.length>0) { string answ=""; answer=engine1.getnextmove(request, null, deep); request=""; if(answer.length>0) answ=answer.substring(0,2)+"-"+answer.substring(2,2); if(answer.length>4) answ+="="+(answer.substring(4,1)).toupper(); ((textmesh)getcomponent(typeof(textmesh))).text=answ; //application.externalcall("jsanswer", answ); (gameobject.find("script2")).sendmessage("engineanswer",answ); } }
it's using valil chess engine (written in c#) appropriate answers (next move). works fine in mono 2.0 failing il2cpp. ideas?
i found answer. when chessengine initialized there chessengine.openingbook class that's initialized. took out class altogether, , worked charm. class looks like:
using system; using system.io; using system.collections.generic; using system.reflection; //using valil.chess.engine.properties; namespace valil.chess.engine { public sealed partial class chessengine { // hashtable board hash key , list of moves board configuration value public static dictionary<int, list<short>> book; // helps choose move when list contains more 1 private random random; /// <summary> /// initializes opening book. /// </summary> private void initializeopeningbook() { // initialize random generator random = new random(unchecked((int)datetime.now.ticks)); int settings_default_openingbooksize = 2755; //int settings_default_openingbookbytesize = 16530; //assembly assembly = assembly.getexecutingassembly(); //string[] ss = assembly.getmanifestresourcenames(); // there no file & manifest assembly in unity3d free... // so, class obookmem opening book!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stream readstream = assembly.getexecutingassembly().getmanifestresourcestream("valil_silverlightchess.book.bin"); // "book.bin" file binary file pattern: int,short,int,short etc. // 4-byte int represent board hash, following 2-byte short move (the first byte represents starting square, second 1 ending square) // read "book.bin" , put values in hashtable try { using (binaryreader br = new binaryreader( readstream )) // using (binaryreader br = new binaryreader(new bufferedstream(assembly.getexecutingassembly().getmanifestresourcestream("valil.chess.engine.book.bin"), settings.default.openingbookbytesize))) // using (binaryreader br = new binaryreader(assembly.getexecutingassembly().getmanifestresourcestream("book.bin"))) { book = new dictionary<int, list<short>>(settings_default_openingbooksize); (int = 0; < settings_default_openingbooksize; i++) { int hash = br.readint32(); short move = br.readint16(); // if hashtable contains hash, add move list // otherwise create new list , add pair hashtable if (book.containskey(hash)) { book[hash].add(move); } else { list<short> list = new list<short>(1); list.add(move); book.add(hash, list); } } } } catch { } } } }
i think il2cpp compiler doesn't system.reflection , dictionary , list types.
Comments
Post a Comment