Wednesday, 15 July 2015

c# - Exception : Collection was modified; enumeration operation may not execute on form Close in setup project -



c# - Exception : Collection was modified; enumeration operation may not execute on form Close in setup project -

i created setup project of window form application built in c# 4.0. tested setup in test pc have vs 2010 ultimate installed in , working fine in it.

i later on test application installed machine not have vs in it. every time seek close form, ends exception. exception occurring in forms not in all. have checked code , and there no difference in it(this.close()).

while building setup using .net framework 4 client profile target framework. microsoft.visualbasic.powerpacks.vs added in setup. not using tab strip nor trying close multiple form.

this finish error unhandled exception has occurred in application. if click continue, application ignore error , effort continue. if click quit, application close rimmediately.

see end of message details on invoking just-in-time (jit) debugging instead of dialog box.

************** exception text ************** system.invalidoperationexception: collection modified; enumeration operation may not execute. @ system.throwhelper.throwinvalidoperationexception(exceptionresource resource) @ system.collections.generic.list`1.enumerator.movenextrare() @ system.collections.generic.list`1.enumerator.movenext() @ microsoft.visualbasic.powerpacks.shapecollection.dispose(boolean disposing) @ microsoft.visualbasic.powerpacks.shapecontainer.dispose(boolean disposing) @ system.componentmodel.component.dispose() @ system.windows.forms.control.dispose(boolean disposing) @ system.componentmodel.component.dispose() @ system.windows.forms.control.dispose(boolean disposing) @ system.componentmodel.component.dispose() @ system.windows.forms.control.dispose(boolean disposing) @ system.windows.forms.form.dispose(boolean disposing) @ ezybizmanager.masters.frmusers.dispose(boolean disposing) @ system.componentmodel.component.dispose() @ system.windows.forms.form.wmclose(message& m) @ system.windows.forms.form.wndproc(message& m) @ system.windows.forms.control.controlnativewindow.onmessage(message& m) @ system.windows.forms.control.controlnativewindow.wndproc(message& m) @ system.windows.forms.nativewindow.callback(intptr hwnd, int32 msg, intptr wparam, intptr lparam) ************** loaded assemblies ************** mscorlib assembly version: 4.0.0.0 win32 version: 4.0.30319.1 (rtmrel.030319-0100) codebase: file:///c:/windows/microsoft.net/framework/v4.0.30319/mscorlib.dll ---------------------------------------- ezybizmanager assembly version: 1.0.0.0 win32 version: 1.0.0.0 codebase: file:///c:/program%20files/microsoft/coe/ezybizmanager.exe ---------------------------------------- system.windows.forms assembly version: 4.0.0.0 win32 version: 4.0.30319.1 built by: rtmrel codebase: file:///c:/windows/microsoft.net/assembly/gac_msil/system.windows.forms/v4.0_4.0.0.0__b77a5c561934e089/system.windows.forms.dll ---------------------------------------- system.drawing assembly version: 4.0.0.0 win32 version: 4.0.30319.1 built by: rtmrel codebase: file:///c:/windows/microsoft.net/assembly/gac_msil/system.drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/system.drawing.dll ---------------------------------------- scheme assembly version: 4.0.0.0 win32 version: 4.0.30319.1 built by: rtmrel codebase: file:///c:/windows/microsoft.net/assembly/gac_msil/system/v4.0_4.0.0.0__b77a5c561934e089/system.dll ---------------------------------------- system.data.linq assembly version: 4.0.0.0 win32 version: 4.0.30319.1 codebase: file:///c:/windows/microsoft.net/assembly/gac_msil/system.data.linq/v4.0_4.0.0.0__b77a5c561934e089/system.data.linq.dll ---------------------------------------- system.core assembly version: 4.0.0.0 win32 version: 4.0.30319.1 built by: rtmrel codebase: file:///c:/windows/microsoft.net/assembly/gac_msil/system.core/v4.0_4.0.0.0__b77a5c561934e089/system.core.dll ---------------------------------------- system.configuration assembly version: 4.0.0.0 win32 version: 4.0.30319.1 (rtmrel.030319-0100) codebase: file:///c:/windows/microsoft.net/assembly/gac_msil/system.configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/system.configuration.dll ---------------------------------------- system.xml assembly version: 4.0.0.0 win32 version: 4.0.30319.1 built by: rtmrel codebase: file:///c:/windows/microsoft.net/assembly/gac_msil/system.xml/v4.0_4.0.0.0__b77a5c561934e089/system.xml.dll ---------------------------------------- system.data assembly version: 4.0.0.0 win32 version: 4.0.30319.1 (rtmrel.030319-0100) codebase: file:///c:/windows/microsoft.net/assembly/gac_32/system.data/v4.0_4.0.0.0__b77a5c561934e089/system.data.dll ---------------------------------------- system.transactions assembly version: 4.0.0.0 win32 version: 4.0.30319.1 (rtmrel.030319-0100) codebase: file:///c:/windows/microsoft.net/assembly/gac_32/system.transactions/v4.0_4.0.0.0__b77a5c561934e089/system.transactions.dll ---------------------------------------- system.enterpriseservices assembly version: 4.0.0.0 win32 version: 4.0.30319.1 (rtmrel.030319-0100) codebase: file:///c:/windows/microsoft.net/assembly/gac_32/system.enterpriseservices/v4.0_4.0.0.0__b03f5f7f11d50a3a/system.enterpriseservices.dll ---------------------------------------- system.xml.linq assembly version: 4.0.0.0 win32 version: 4.0.30319.1 built by: rtmrel codebase: file:///c:/windows/microsoft.net/assembly/gac_msil/system.xml.linq/v4.0_4.0.0.0__b77a5c561934e089/system.xml.linq.dll ---------------------------------------- anonymously hosted dynamicmethods assembly assembly version: 0.0.0.0 win32 version: 4.0.30319.1 (rtmrel.030319-0100) codebase: file:///c:/windows/microsoft.net/assembly/gac_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll ---------------------------------------- microsoft.visualbasic.powerpacks.vs assembly version: 10.0.0.0 win32 version: 10.0.20911.1 codebase: file:///c:/windows/assembly/gac_msil/microsoft.visualbasic.powerpacks.vs/10.0.0.0__b03f5f7f11d50a3a/microsoft.visualbasic.powerpacks.vs.dll ---------------------------------------- microsoft.visualbasic assembly version: 10.0.0.0 win32 version: 10.0.30319.1 built by: rtmrel codebase: file:///c:/windows/microsoft.net/assembly/gac_msil/microsoft.visualbasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll ----------------------------------------************** jit debugging **************

to enable just-in-time (jit) debugging, .config file application or computer (machine.config) must have jitdebugging value set in system.windows.forms section. application must compiled debugging enabled.

for example:

<configuration> <system.windows.forms jitdebugging="true" /> </configuration>

when jit debugging enabled, unhandled exception sent jit debugger registered on computer rather handled dialog box.

[edited:] using image close form.

private void imgclose_click(object sender, eventargs e) { this.close(); }

i think it's bug in dispose() method of shapecollection. if @ method using illustration .net reflector, microsoft.visualbasic.powerpacks.vs, version=9.0.0.0, says this:

foreach (shape shape in this.m_shapes) { shape.dispose(); }

and if @ method using microsoft.visualbasic.powerpacks.vs, version=10.0.0.0, says this:

(int = this.m_shapes.count - 1; >= 0; i--) { this.m_shapes[i].dispose(); }

clearly, implementation has evolved between versions. latter 1 doesn't rely on enumerator object , hence cannot fail error show.

what's unusual though stackframe seems imply you're running off version 10, shouldn't utilize enumerator?? maybe need vs 2010 update? or can check @ dispose implementation on microsoft.visualbasic.powerpacks.vs you're using.

edit: after digging, application indeed runs on old version of vb powerpacks. upgrade vs2010, sp1 or re-create dll installation. specific dispose bug, need @ to the lowest degree 10.0.30319.1.

c# winforms setup-deployment

No comments:

Post a Comment