Solved

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

Posted on 2007-12-03
49
433 Views
Last Modified: 2013-12-27
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
Comment
Question by:gbzhhu
  • 26
  • 23
49 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 20395159
Try opening the WebService from Pocket Internet explorer on your device.
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20395487
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20395565
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
 
LVL 12

Author Comment

by:gbzhhu
ID: 20395623
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20395654
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
 
LVL 12

Author Comment

by:gbzhhu
ID: 20395763
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20395793
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
 
LVL 12

Author Comment

by:gbzhhu
ID: 20395866
I am running Mindows Mobile Device Center (on Vista) and not Activesync.  
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 20395877
6.0 or 6.1?
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20395888
6.0.6783 is the exact version
0
 
LVL 48

Accepted Solution

by:
Mikal613 earned 500 total points
ID: 20395902
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20395967
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20395988
Windows Mobile Device Center
Windows Mobile Device Center Driver Update
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20396336
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20396392
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
 
LVL 12

Author Comment

by:gbzhhu
ID: 20396594
>>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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20396610
can we test on GPRS?
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20396762
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20396771
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
 
LVL 12

Author Comment

by:gbzhhu
ID: 20396797
>>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
 
LVL 12

Author Comment

by:gbzhhu
ID: 20396843
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20396846
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
 
LVL 12

Author Comment

by:gbzhhu
ID: 20396969
>>Can you run the method that you would have run on your PPC?

   run it were on desktop?
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 20396984
in PIE
0
Too many email signature updates to deal with?

Do you feel like you are taking up all of your time constantly visiting users’ desks to make changes to email signatures? Wish you could manage all signatures from one central location, easily design them and deploy them quickly to users? Well, there is an easy way!

 
LVL 12

Author Comment

by:gbzhhu
ID: 20397006
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20397016
not really

the method did not run.

Were you able to run it on the desktop ?
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 20397023
did you Create an Instance of your WebService before calling it?
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20397030
just creating a desktop test
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 20397040
how did you add your web refernce to the Mobile project?
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20397047
>>did you Create an Instance of your WebService before calling it?

In my device code I did create an instance.
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20397113
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
 
LVL 12

Author Comment

by:gbzhhu
ID: 20397121
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20397127
ok we are getting somewhere.


Lets try installing SP1 for CF2

http://blogs.msdn.com/netcfteam/archive/2006/06/21/642013.aspx
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 20397153
we will get it!!!!!
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20401730
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20402478
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20403094
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20403110
do you see the framework version in "Remove Programs" in the settings?
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20403187
Yep, I see

Microsoft .NET CF 2.0
Microsoft .NET CF 1.0 ENU-string
Microsoft .NET CF 2.0 ENU-string
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 20403211
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
 
LVL 12

Author Comment

by:gbzhhu
ID: 20403258
Cool
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20403359
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20403379
what was the Exception.Message?
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20403508
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
 
LVL 12

Author Comment

by:gbzhhu
ID: 20403533
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20403539
lets install it again
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20403579
Still same error.  2 exceptions listed

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

I'll try the other cab
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 20403799
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 20403807
No problem
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now