c# - What is behind a silent failure to load resource on x64 bit machine with .NET 4.0? -
a user of program has reported inability startup application. not yet done troubleshooting, i'm baffled.
logging still works, used logging statements , able narrow down crash single line in user control's initializecomponent:
this.horizontalbox.image = ((system.drawing.image)(resources.getobject("horizontalbox.image")));
here relevant clues end:
- 64 bit windows 7
- correct .net framework (4.0 client profile)
- no visual elements ever show, , no error dialogs. silent shutdown when starting.
- logging works, there no logged errors.
- he has uninstalled , reinstalled .net 4.0 client profile framework.
- he doesn't have visual studio or other development tools mucking stuff.
i have spent week or eliminating theories , i'm becoming confused , desperate. here relevant details , things have found:
- i targeting x86 explicitly.
- the logging failed log exception set catch , log unhandled exceptions , thread abort exceptions.
- whatever killing application prevents final "shutting down" logging message in program's basic entry point.
- i had read icon (.ico) file formats don't work in windows xp. far fetched theory, since windows 7. 1 , case of ico files in project, suspicious , switched png. no difference. since figure image failing merely because first image loaded resource.
- i had read form_load event may swallow exceptions (and when debugging). also, initializecomponent() in constructor, theory shaky. nonetheless, wrapped call initializecomponent() in try/catch, catch , associated logging never called.
- i have seen posts resource compilation problems between x86 , x64, nothing relevant runtime issues. (see this post)
- i assumed there must wrong unique program showing issues, made windowsformsapplication1 test application nothing more single image embedded in associated resource file. fails load in same way. test application targeting x86.
- it works fine on other x86 , x64 machines!
what possibly going on machine? why exception handling failing me? problem crazy!
edit: more details, , i'm still baffled!
- i have since sent test application (a single form single image on it) built x86, x64, , "any cpu". x64 , "any cpu" applications both work.
some questions spring mind. have got similar build machine test - may identify if build/program integration or possible issue build (i.e. windows problem/virus/etc).
has installed default folder or did customised install?
has tried full uninstall / reinstall of app? (i note said runtime refreshed) - possibly different folder make sure.
can recreate on similar build (os version) vs installed code walkthrough in debugger - stack trace , output buffer may identify - may disasembly - , can set stop @ exceptions?
unfortunatly unhandled exceptions can not caught in c# (especially post 2.0) - debugger of windbg may option in end (yuk!).
can suggest though first...just thought:
before line fails, test, output this:
var obj = resources.getobject("horizontalbox.image"); console.writeline("obj = " + (obj bitmap));
because have feel failure happening when trying marshal resource bitmap type , getting memory exception (maybe corrupt image stride/pixel format etc or maybe on culprit machine making image file non image file).
Comments
Post a Comment