c# - CameraCaptureDialog fails with "An unknown error occurred" -


i'm working on windows mobile 6.1 app written in c#. have added ability take photos. device intermec cn50. code works fine if open app , go directly bit takes photos. if go through few other screens , open photo bit fails incredibly useful message "an unknown error occurred". there no other useful information in exception can see. code fails on line:

cameraresult = cameradialog.showdialog(); 

here's stack trace:

at microsoft.windowsmobile.forms.cameracapturedialog.launchcameracapturedialog(intptr ptrstruct) @ microsoft.windowsmobile.forms.cameracapturedialog.showdialog() @ micronetmobileui.controls.camera.showdialog(form owner, string& filename) @ micronetmobileui.fieldservice.jobimagesform.loadcamerascreen() @ micronetmobileui.fieldservice.jobimagesform.footertoolbar_itementered(object sender, eventargs e) @ resco.controls.commoncontrols.toolbarcontrol.onitementered() @ resco.controls.commoncontrols.toolbarcontrol.mouseclickup(mouseeventargs e) @ resco.controls.commoncontrols.toolbarcontrol.onmouseup(mouseeventargs e) @ system.windows.forms.control.wnproc(wm wm, int32 wparam, int32 lparam) @ system.windows.forms.containercontrol.wnproc(wm wm, int32 wparam, int32 lparam) @ system.windows.forms.control._internalwnproc(wm wm, int32 wparam, int32 lparam) @ microsoft.agl.forms.evl.entermainloop(intptr hwnmain) @ system.windows.forms.application.run(form fm) @ micronetmobileui.applicationmanager.startapp() @ micronetmobileui.program.main() 

here's code:

var path = path.getdirectoryname(assembly.getexecutingassembly().getname().codebase); var filename = "temp.jpg";   var pathandfilename = path.combine(path, filename);  var cameradialog = new cameracapturedialog(); cameradialog.owner = this; cameradialog.initialdirectory = path; cameradialog.defaultfilename = filename; cameradialog.mode = cameracapturemode.still; cameradialog.stillquality = cameracapturestillquality.low; cameradialog.videotimelimit = new timespan(0, 0, 0); cameradialog.videotypes = cameracapturevideotypes.messaging; cameradialog.resolution = new size(640, 480);   // open camera dialog take photo dialogresult cameraresult; try {     cameraresult = cameradialog.showdialog(); } catch (exception ex) {     messagebox.show("grrrr!!"); }        {     cameradialog.dispose();     cameradialog = null; }  if (cameraresult != dialogresult.ok)     return; // no photo taken  // save photo using value: pathandfilename ... 

i guess running low on memory don't know. far i've tried:

1) instatiating cameracapturedialog when app first starts can memory.

2) instatiating cameracapturedialog , calling showdialog() when app first starts up.

3) closing connection local sql ce database before instantiating cameracapturedialog (this suggested on forum).

4) running gc.collect() before instantiating (yes know not idea).

5) reducing cameradialog.resolution 320 240.

nothing works. spent ages adding functionality app , find works sometimes. windows mobile can annoying. help!!

while not on cn50, i've hit similar problem on different intermec device. turned out because barcode scanner / decoder , camera shared common infrastructure must not accessed @ same time.

try commenting out or mocking out barcode objects , see if can utilize camera after navigating app.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -