Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 470
  • Last Modified:

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

0
gbzhhu
Asked:
gbzhhu
  • 26
  • 23
1 Solution
 
Mikal613Commented:
Try opening the WebService from Pocket Internet explorer on your device.
0
 
gbzhhuAuthor Commented:
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 :-(
0
 
Mikal613Commented:
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
gbzhhuAuthor Commented:
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
0
 
Mikal613Commented:
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.
0
 
gbzhhuAuthor Commented:
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.
0
 
Mikal613Commented:
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.
0
 
gbzhhuAuthor Commented:
I am running Mindows Mobile Device Center (on Vista) and not Activesync.  
0
 
Mikal613Commented:
6.0 or 6.1?
0
 
gbzhhuAuthor Commented:
6.0.6783 is the exact version
0
 
gbzhhuAuthor Commented:
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
0
 
Mikal613Commented:
Windows Mobile Device Center
Windows Mobile Device Center Driver Update
0
 
gbzhhuAuthor Commented:
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!
0
 
Mikal613Commented:
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.
0
 
gbzhhuAuthor Commented:
>>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!

0
 
Mikal613Commented:
can we test on GPRS?
0
 
gbzhhuAuthor Commented:
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
0
 
Mikal613Commented:
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?
0
 
gbzhhuAuthor Commented:
>>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
0
 
gbzhhuAuthor Commented:
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();  
            }
0
 
Mikal613Commented:
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?
0
 
gbzhhuAuthor Commented:
>>Can you run the method that you would have run on your PPC?

   run it were on desktop?
0
 
Mikal613Commented:
in PIE
0
 
gbzhhuAuthor Commented:
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
0
 
Mikal613Commented:
not really

the method did not run.

Were you able to run it on the desktop ?
0
 
Mikal613Commented:
did you Create an Instance of your WebService before calling it?
0
 
gbzhhuAuthor Commented:
just creating a desktop test
0
 
Mikal613Commented:
how did you add your web refernce to the Mobile project?
0
 
gbzhhuAuthor Commented:
>>did you Create an Instance of your WebService before calling it?

In my device code I did create an instance.
0
 
gbzhhuAuthor Commented:
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.

0
 
gbzhhuAuthor Commented:
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
0
 
Mikal613Commented:
ok we are getting somewhere.


Lets try installing SP1 for CF2

http://blogs.msdn.com/netcfteam/archive/2006/06/21/642013.aspx
0
 
Mikal613Commented:
we will get it!!!!!
0
 
gbzhhuAuthor Commented:
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!!
0
 
Mikal613Commented:
0
 
gbzhhuAuthor Commented:
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.
0
 
Mikal613Commented:
do you see the framework version in "Remove Programs" in the settings?
0
 
gbzhhuAuthor Commented:
Yep, I see

Microsoft .NET CF 2.0
Microsoft .NET CF 1.0 ENU-string
Microsoft .NET CF 2.0 ENU-string
0
 
Mikal613Commented:
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
0
 
gbzhhuAuthor Commented:
Cool
0
 
gbzhhuAuthor Commented:
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
0
 
Mikal613Commented:
what was the Exception.Message?
0
 
gbzhhuAuthor Commented:
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
0
 
gbzhhuAuthor Commented:
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.
0
 
Mikal613Commented:
lets install it again
0
 
gbzhhuAuthor Commented:
Still same error.  2 exceptions listed

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

I'll try the other cab
0
 
gbzhhuAuthor Commented:
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
0
 
Mikal613Commented:
No problem
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 26
  • 23
Tackle projects and never again get stuck behind a technical roadblock.
Join Now