Link to home
Start Free TrialLog in
Avatar of gbzhhu
gbzhhuFlag for United Kingdom of Great Britain and Northern Ireland

asked on

An error cannot be displayed because an optional assembly could not be found

Hi,

I hope you can help me with a question or 2 I have on a new device.  We have Symbol MC35 device.  I installed .NET CF 2.0 and my app.  It runs the application and at the point of accessing my web service on the server it comes up with the dreaded error "An error cannot be displayed because an optional assembly could not be found".  I hate this error :-(  I install System_SR_ENU_wm.cab  It doesn't help.  I changed my locale from UK to USA - nothing changed.  I cannot run the app in debug mode via VS because this device always fails to connect to the web service via USB to my PC (I don't know if it is possible to run app via debug mode through the device using GPRS).  Other devices work fine.

- How do I display the correct error rather than this aweful generic error.
- As other devices work, any guesses why this cannot access the web (I am using a sim card from a different but working device - which is GPRS enabled)
- Could you give me any suggestions.  What would you do in this scenario?

Thanks

Avatar of Mikal613
Mikal613
Flag of United States of America image

Try opening the WebService from Pocket Internet explorer on your device.
Avatar of gbzhhu

ASKER

Nothing can be opened fomr Pocket IE.  Not my web service and nothing else.

I tried this http://www.geekzone.co.nz/forums.asp?ForumId=6&TopicId=11051
and it didn't help :-(
so its not a problem with your PPC app.

So how do you expect to have your app run if theres a problem with the web service?

Try removing the web reference and add it again.
Avatar of gbzhhu

ASKER

Didn't recognise it is good old Mikal613 :-)

My web service is fine.  I can connect another device to PC via USB and the app works fine.  This particular device fails at the point of accessing the web service and so the fact that it cannot connect to the Internet AT ALL is what I am trying to figure out how to fix.  The device is MC35 (from Symbol) and is running WM 5.0  App starts running which suggests correct framework is installed.  My question is why can't this device connect to the Internet via USB through my PC.  if I stick a sim card which is GPS enabled then i can list my web service methods on Pocket IE in this device.

Hope you understand me now.

Cheers
Ok gotcha Now!!!

When you goto the network card settings is the Combo Box on Work or on Internet?

Please set to internet and try again.
Avatar of gbzhhu

ASKER

Ok, that was set to Work. Changed it to Internet.  Now when I fire PIE, first it said connecting to MyConnection which I created but really didn't know how to set it up (just kept pressing next then finish so I doubt it is a valid connection).  I removed that connection and now it says "cannot connect with current connection settings" so it looks like I need to setup a connection.  How do I do it.  I want it to connect via USB if available if not try GPRS.  My other device does that but I don't know who set it up.
Ok so it sound like GPRS it not setup.

So lets set that up.

Now right click on the ActiveSync tray icon on your dektop and goto Connection Settings.

Make sure that "Allow USB Connections" is set  and "Allow wireless Connections on device..." is not checked.

Restart computer and Device and then connect.
Avatar of gbzhhu

ASKER

I am running Mindows Mobile Device Center (on Vista) and not Activesync.  
6.0 or 6.1?
Avatar of gbzhhu

ASKER

6.0.6783 is the exact version
ASKER CERTIFIED SOLUTION
Avatar of Mikal613
Mikal613
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gbzhhu

ASKER

Ok cool.  before I do anything, the file I downloaded is called drvupdate-x86.exe.  Looking at my Add Remove programs there are

Windows Mobile 5.0 Pocket PC SDK
Windows Mobile Device Center
Windows Mobile Device Center Driver Update

Which ones should I be Uninstalling?  I'd hate to mess up my existing setup which works with other devices apart from this particular one
Windows Mobile Device Center
Windows Mobile Device Center Driver Update
Avatar of gbzhhu

ASKER

Alright, tried that.  rebooted machine and reset device.  still getting error "HTTP error 500 Internal server error"  any idea Mikal?  When I click on the connection status it says ActiveSync connected and my desktop Mob Dev Center shows connected too but PIE is not working!
a)On your device, go to ActiveSync, and click Sync

Also disconnect your device and dont setup the parternership.

See what happens with that.

Perhaps its a firewall problem. If you disable your firewall see if that helps.
Avatar of gbzhhu

ASKER

>>a)On your device, go to ActiveSync, and click Sync
        Done but it stilll displays
         Result:    Synchronized
         Last synchronized:   20/11/07  17:50
         Last attempt:   20/11/07  17:50

Also disconnect your device and dont setup the parternership.
         What do you mean disconnect? from USB? if so how can I do a test without USB connection
         I never setup partnership before for this device

See what happens with that.
         How?
Perhaps its a firewall problem. If you disable your firewall see if that helps.
         I doubt it.  This device could access the Internet before using a GPRS enabled sim card.  however, I tried it just now and that doesn't work, I guess I have fiddled with too many settings, d'oh!

can we test on GPRS?
Avatar of gbzhhu

ASKER

I inserted the sim wrongly cos of some frustration!!  Now I can test things with GPRS and PIE is fine and my web service is accessible.  I run my app and it fails but I think that is after accessing the web service (I am 80% positive :-o ).  What I would like is to use USB and VS 2005 to debug, this was the whole idea but the USB Internet connection wasn't having it
I understand. There are alot of problems with WMDVC at home it works like 30% of the time i want it.

If you access the web service through pie are there any errors?
Avatar of gbzhhu

ASKER

>>If you access the web service through pie are there any errors?
   
     Not if I access it via GPRS.  The methods are listed OK

     If no GPRS then cannot connect to Internet
Avatar of gbzhhu

ASKER

I just tried USB and VS 2005 debug - no good.  look at this code and see comments in it in CAPS AND HOPE YOU UNDERSTAND WHERE i AM NOW (practically stuck but not giving hope yet)

            try
            {
                MobileCentaur.MyCentaurSvc.CentaurSvc.MobileSvc svc = new MobileCentaur.MyCentaurSvc.CentaurSvc.MobileSvc();
WITH USB THE WEBSERVICE OBJECT IS CREATED
                if (svc.ServiceAvailable())    THIS CALL RAISES AN EXCEPTION (USING USB)
                {
                    this.lblProgress.Text = svcIsavialable; WITH GPRS WE GET TO HERE SO LABEL SAYS WEB SERVICE IS AVAILABLE
                    Application.DoEvents();
                    Thread.Sleep(500);
                }
            }
            catch (Exception ex)
            {
                this.lblProgress.Text = svcNotavialable;
                MessageBox.Show(svcNotavialable + "\n\n" + ex.ToString(), "Service not available", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                Application.Exit();
            }

            try
            {
WITH GPRS WE REACH HERE AND I THINK THE ERROR IS I/O PROBLEM BUT I GET THAT OBSCURE ERROR - OPTIONAL RESOURCE BLAH BLAH.  I CAN'T CHECK THIS WITH USB COS ONCE USB IS PLUGGED THE DEVICE WILL ALWAYS USE IT AND NOT GPRS !!
                //Check to see if userList.xml exists
                if (File.Exists(Common.userListFile))
                    this.LoadUsers();

                lblProgress.Text = "Please login to the MyCentaur mobile service";
                this.pnlLogin.Visible = true;
                this.cboUsers.Focus();

                this.HookEvents();

                Cursor.Current = Cursors.Default;  
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message, "Error loading login form", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                Application.Exit();  
            }
we will concentrate on GPRS for now.
Not if I access it via GPRS.  The methods are listed OK

Can you run the method that you would have run on your PPC?
Avatar of gbzhhu

ASKER

>>Can you run the method that you would have run on your PPC?

   run it were on desktop?
in PIE
Avatar of gbzhhu

ASKER

I don't know how to run a web method in PIE but when methods were listed I clicked on the first method called and I got PIE display

ServiceAvailable     which the method name and then

Test form is only available for requests from local machine then

Soap 1.1 request and response

then

Soap 2.0 request and response

This tells me method is OK
not really

the method did not run.

Were you able to run it on the desktop ?
did you Create an Instance of your WebService before calling it?
Avatar of gbzhhu

ASKER

just creating a desktop test
how did you add your web refernce to the Mobile project?
Avatar of gbzhhu

ASKER

>>did you Create an Instance of your WebService before calling it?

In my device code I did create an instance.
Avatar of gbzhhu

ASKER

It took this to test on desktop

I added web reference (server not my local PC)
        private void button1_Click(object sender, EventArgs e)
        {
            testSvc.MobileSvc svc = new testSvc.MobileSvc();
            MessageBox.Show(svc.ServiceAvailable().ToString());
        }

I get a messagebox that says True.  All looks good to me.

>>how did you add your web refernce to the Mobile project?
Via add web reference dialog then typed web service url on the server then renamed it to something meaningful and voila.  I am pretty certain that is not the issue because another device right next to me now takes the same sim card and runs my app via GPRS na dit has no problem at all - the complete app runs fnie with that other device.

Avatar of gbzhhu

ASKER

I gotta run home my friend.  see if you can think of anything to get me out of this nasty scenario.

Cheers and speak to you tomorrow.

H
ok we are getting somewhere.


Lets try installing SP1 for CF2

http://blogs.msdn.com/netcfteam/archive/2006/06/21/642013.aspx
we will get it!!!!!
Avatar of gbzhhu

ASKER

OK thanks.

I actually have CF 2.0 sp2 installed.  I believe so.  I tried to install it (CF 2 sp2) just to be sure but it says that a newer version is already installed!!
Avatar of gbzhhu

ASKER

I don't seem to be able to get to the download.  I googled and so other links to the same tool but they don't work - server trouble maybe.  To be sure IO have version 2 sp2, I can remove ehatever version is on the device now and install it.
do you see the framework version in "Remove Programs" in the settings?
Avatar of gbzhhu

ASKER

Yep, I see

Microsoft .NET CF 2.0
Microsoft .NET CF 1.0 ENU-string
Microsoft .NET CF 2.0 ENU-string
wow you got alot there.

Lets remove them all and install 2.0 SP2

http://www.microsoft.com/downloads/details.aspx?familyid=aea55f2f-07b5-4a8c-8a44-b4e1b196d5c0&displaylang=en

also before you test your app

Goto the project properties of your WM App and goto "Devices" and Unselect "Deploy the latest version of the .Net...."

and then test
Avatar of gbzhhu

ASKER

Cool
Avatar of gbzhhu

ASKER

Done that.  No change.  Still fails to connect to the service.  ASlthough error message is obscure I get this info

Exception System.Net.Sockets

So it looks like a connection problem
what was the Exception.Message?
Avatar of gbzhhu

ASKER

Same as before
"An error cannot be displayed because an optional assembly could not be found"  This is said to be because assembly that holds resource strings is installed.  This assembly is IN System_SR_ENU_wm.cab which I had already installed but removed a minute ago
Avatar of gbzhhu

ASKER

There is also System_SR_ENU.cab but I assumed the one with the wm is the correct version.

This device says OS is Windows Mobile 5.0 Phone Edition.  The working device says OS is Windows Mobile Version 5.0.  I believe they are the same.
lets install it again
Avatar of gbzhhu

ASKER

Still same error.  2 exceptions listed

System.Net.WebException
System.Net.Sockets.SocketException

I'll try the other cab
Avatar of gbzhhu

ASKER

Hahaaaaa!!

Found it!!

It was a connection problem.  You see I don't know what I need to do to setup connection between device and PC but Mobile Center and VS 2005 behaved clever and let me believe all is good.  Vs can detect the device and start debugging app but the device is not setup to connect to Internet via PC.  I just played with Device Center under Mobile Device Settings - sync settings - it started synching then created a partnership and hey voila!! everything works.  There an error that occurs after accessing the web service, trying to open a file on device which was 0 bytes.  i couldn't debug it though with those stupid errors.  Still I am getting that dreadful error everytime an exception occurs.

Phew!  thank you Mikal for your dedication, you really kept me focused and not give up.
H
No problem