Having problem when I make a Build EXE file , but runs fine from inside editor IDE

Hi,

I have been having issues with my game build. This is a Hidden object game that we are workin on.The game works absolutely fine when I run it from IDE but when I make a build EXE file I am facing issues.

I’m using Hashtable (in JS) to store and call functions as ICallable
All works correct in IDE, but not in final exe

From application behaviour I see

  1. Callback functions came into the Hashtable store
  2. Some of them delete themselves after first call
  3. But they still execute

I found next:

  1. Time to time debugger shows several errors about problems with locating Hashtable and hint me that must be System.Collections.Hashtable, but not at the start of application (seems that place is random)
  2. Can’t trace all breakpoints. Some of them become inaccessible for unknown reason

Can anyone help me out with this issue. This is a Hidden Object Game that I am working on…

You probably need to provide a few more details. Meaning the code that uses the hashtable.

Hi Dantus this is the code…

public class EventDispatcher{
private var _hHandlers :Hashtable = new Hashtable();
private var _hCleanup :Hashtable = new Hashtable(); private var _hNew :Hashtable = new Hashtable();

public function EventDispatcher(){
super();
}

protected function callHandlers(id:String, eventObject):void{
var handlers :ICollection;
var handler :ICallable;

if(_hNew[id] == null){
return;
}

if(_hNew[id].Count){
handlers = _hNew[id].Keys;
for (handler in handlers){
_hHandlers[id][handler] = 1;
}

_hNew[id].Clear();
}

if(_hCleanup[id].Count){
handlers = _hCleanup[id].Keys;
for (handler in handlers){
_hHandlers[id].Remove(handler);
}

_hCleanup[id].Clear();
}

if(_hHandlers[id].Count){
handlers = _hHandlers[id].Keys;
for (handler in handlers){
handler(eventObject);
}
}
}

public function hasListener(id:String, handler:ICallable):Boolean{
if(_hNew[id] == null){
return false;
}

if(_hCleanup[id][handler]==null (_hNew[id][handler] || _hHandlers[id][handler])){
return true;
}

return false;
}

public function addListener(id:String, handler:ICallable):void{
if(_hNew[id] == null){
_hHandlers[id] = new Hashtable();
_hCleanup[id] = new Hashtable();
_hNew[id] = new Hashtable();
}

_hNew[id][handler] = 1;

if(_hCleanup[id][handler]){
_hCleanup[id].Remove(handler);
}
}

public function removeListener(id:String, handler:ICallable):Boolean{
if(_hNew[id] == null){
return false;
}

if(_hNew[id][handler]){
_hNew[id].Remove(handler);
}else if(_hHandlers[id][handler]){
if(_hCleanup[id][handler] == null){
_hCleanup[id][handler] = 1;
}else{
return false;
}
}else{
return false;
}

return true;
}

public function dispatchEvent(id:String, eventObject):void{
callHandlers(id, eventObject);
}

}

First of all, I nearly never use JavaScript. So with my little experience, it is likely, that I may miss things.
Here is one thing I found, maybe related to

I don’t know how often hasListener is called. But it has a potential problem. You call _hCleanup[id][handler] and _hHandlers[id][handler]. But how do you know that _hCleanup[id] and _hHandlers[id] are not empty?

Don’t know if that may produce different results in the editor and executables.

Thanks a lot for the suggestion … i will check this out…hope it works :slight_smile:

All 3 of them initialized at the same time… so

if(_hNew[id] == null){
  return false;
}

must be enough

DeKa. That’s true! I missed that.

seems that for some reason _hHandlers[id].Remove(handler) did not work properly
some times it don’t want to remove items… maybe holding Functions as a keys was bad idea

if(_hCleanup[id].Count){
	handlers = _hCleanup[id].Keys;
	for (handler in handlers){
		_hHandlers[id].Remove(handler);
	}

	_hCleanup[id].Clear();
}

saved method handles from

_hCleanup[id]
{133483288,133470072}

_hHandlers[id] — before remove
{133483288,133470072,133483416}

_hHandlers[id] — after remove
{133470072,133483416}