locked
The Web Browser Project Problem RRS feed

  • Question

  • I have been referred to this forum, because apparently it's a deployment issue. The original is below.
    http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/d7efe285-d284-434d-b23d-0123f69eaf74

    The message has been copied and pasted.

    Hello all,
    I have a problem with the web browser project. This problem is that when you start the application on a computer without VB 2008 (the programming environment), it crashes. On vista is says "The Web Browser Project has stopped working", and on XP it says "The Web Browser Project has encountered a problem and needs to close. We are sorry for the inconvenience". Problem CLR20R system.invalidoperationexception. If you do have vb 2008, no problems whatsoever. Also, a shoutout to kleinma for his custom browser popup code (he has his own class, which I used). I would give you my source, but there is a max of 60,000 characters
    Saturday, March 13, 2010 3:11 PM

Answers

  • Colin,

    You weren't offensive, I think you're frustrated. I just didn't want you to think you're being ignored because you don't get an immediate response.

    What happens when you put the messagebox before InitializeComponent? What exactly is the error? This should work.

    Are you deploying the Visual Basic PowerPacks as a prerequisite, and did you install the application by running setup.exe (which installs the prerequisites) on the target machines? Or did you install the PowerPacks on the target machine?

    What version of .NET 2.0 is installed? If you go to C:\Windows\Microsoft.NET\Framework\v2.0.507020\ and look for mscorlib.dll, right-click and do Properties and go to the details tab, what version is it? For example, mine is 2.0.50727.4927.

    Are you deploying .NET 2.0 as a prerequisite? Are you deploying the version with SP-2 included (posted at the top of this forum) ?

    What is this reference: Kleinma.Controls.WebBrowserEx
    Are you deploying the dll or whatever it is that it requires, and is it deployed locally or in the GAC? Do you see it on the target machine?

    How about this one: dwmapi.dll

    RobinDotNet

    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by RobinDotNet Monday, March 15, 2010 10:47 PM
    • Unmarked as answer by RobinDotNet Monday, March 15, 2010 10:48 PM
    • Proposed as answer by RobinDotNet Monday, March 15, 2010 10:48 PM
    • Marked as answer by Aland Li Wednesday, March 17, 2010 9:21 AM
    Sunday, March 14, 2010 11:57 PM
  • My guess is it's not finding this one at least: Kleinma.Controls.WebBrowserEx

    Where did that come from? Is there an install package for it?

    Also, I would turn the splash screen off and see if you can see the messagebox, just to make sure.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by RobinDotNet Monday, March 15, 2010 10:47 PM
    • Marked as answer by Aland Li Wednesday, March 17, 2010 9:21 AM
    Monday, March 15, 2010 3:58 AM
  • You're welcome, Colin.

    If you really want to use the PowerPacks, you just need to deploy them as a prerequisite. If you're using ClickOnce or a setup & deployment package, go into the publish tab and click on the Prerequisites button. You should find the VB Power Packs in there, and be able to select it.

    If you're using your own deployment method, get the redistributable for the PowerPacks and deploy it as a prerequisite.

    Basically, anything you are referencing that is not an inherent part of the .NET Framework needs to be deployed and installed on the user's computer, or it won't run.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by Aland Li Wednesday, March 17, 2010 9:21 AM
    Monday, March 15, 2010 10:47 PM

All replies

  • It looks like some runtime is missing. Our is this happening when the application is running already. What's the "Web Browser" project anyway? Do you mean you are using the Internet Explorer WebBrowser control?
    Sebastian Brand [www.instyler.com] [blog.sebastianbrand.com]
    Saturday, March 13, 2010 4:07 PM
  • Hello Colin,

    I read the other threads, and as I posted there, the guy is probably right. You are missing some reference that your application needs in order to run.

    First, make sure the client machine has the right version of .NET, and make sure you've run Windows Updates on it. If you have .NET 3.5, make sure SP-1 is installed.

    Next, you need to go through the references your project uses and make sure everything is installed. I noticed in the other thread that you have an include for Interop Services -- are you using Office in your code anywhere? If so, you need to deploy the Primary Interop Assemblies.

    You said you installed VS2008 on the machine and that didn't fix the problem. This means there is something installed on your machine that's not on the other one, maybe something extra that you installed, some add-in or something that you are using in your application that it is picking up in the Global Assembly Cache (GAC).

    Good luck.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Saturday, March 13, 2010 5:21 PM
  • Thanks for replying guys!

    @RobinDotNet - The devs machine and the client machine are both running .NET framework 2.0.50727.4200. The devs machine has .NET SP1, and the client machine used to, but I uninstalled it because I was desperate for a solution. It has been reinstalled for testing purposes and still no cigar. All computers are always kept up to date. I'm going to go through those assemblies now. It does not use any type of special control, no media player, or office control. The only thing I can possibly think of is kleinma's special class. I'm using the interop services include so that I can draw aero glass onto the form. I'll get back to you with the references.

    @Sebastian - The Web Browser Project is a high tech web browser that uses kleinma's special web browser control. It's the same webbrowser control, just with 2 new events, newwindow2 and onerror. And the problem is happening on startup. You see the splash screen, then as soon as it tries to open form1 - BOOM it explodes.
    Saturday, March 13, 2010 7:22 PM
  • All the references look like they're just normal VB references. I've compiled a list for you to see if I'm mistaken.
    System
    System.Core
    System.Data
    System.Data.DataSetExtensions
    System.Deployment
    System.Design
    System.Drawing
    System.Windows.Forms
    System.Xml
    System.Xml.Linq 
    
    ' And my imported namespaces:
    
    Microsoft.VisualBasic
    System
    System.Collections
    System.Collections.Generic
    System.Data
    System.Drawing
    System.Diagnostics
    System.Windows.Forms
    System.Xml
    System.Xml.Linq
    Saturday, March 13, 2010 7:32 PM
  • I have checked the references and every last one of them exists on both the client machine and the development machine =(
    Saturday, March 13, 2010 8:03 PM
  • I have news: I tried installing the web browser project on my bro's computer, vista home premium, and it ran successfully (he DOES NOT have visual studio, only the runtime). Then I tried running it on xp again, and it crashed with the same error. I'm starting to think it's just XP and vista home basic that don't like it. Anyone know why? What are the similarities of xp and vista home basic? Why does it crash on vista home basic, but not premium, buisness, ultimate, or all versions of windows 7??? I NEED answers! This is making me pull me hair out.

    Saturday, March 13, 2010 11:12 PM
  • Is this such a confusing problem???
    Sunday, March 14, 2010 2:10 AM
  • It should be worth noting that I put a little MsgBox on Form1_Load, and it never showed up. Therefore, it never even gets to form1. Something is stopping it from exiting the splash screen, and loading up form1.
    Sunday, March 14, 2010 3:34 AM
  • Is your project in C# or VB? I would troubleshoot this by putting in a BUNCH of messagebox statements. If it's in C#, I would start in Program.cs; if it's in VB, I would start in the application startup event.

    If it won't show a messagebox on the form load event, then it could be something in InitializeComponent that's causing you problems. Put a messagebox before the call to InitializeComponent in the constructor for the form -- does that show up?

    The difference between Windows XP and Vista is that Vista has .NET 3.0 installed on it by default. The difference between XP and Windows7 is that Windows 7 has .NET 3.0 and .NET 3.5 installed on ite by default.

    So my next question to you is this: are you deploying .NET 3.5 SP-1 as a prerequisite to your application? Have you installed .NET 3.5 SP-1 on the Windows XP machine? I'm assuming your target framework is .NET 3.5 of course.

    Also, per this question: Is this such a confusing problem???
    Apparently it is, because you can't figure it out, and it's hard for those of us trying to help you because we can't see your code and the references and what it's doing.

    Also, in case you didn't know, anybody posting answers in here who doesn't work for Microsoft is doing so on their own time, and since we have jobs in addition to helping out here, we aren't always going to be able to respond right away, so please be patient.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Sunday, March 14, 2010 7:24 PM
  • OK, I'm VERY confused now...tried it on the church's laptop...it has 7...and it doesn't work. So it doesn't work on XP, does work on vista , but not on 7.
    What the ****????? The target framework is actually 2.0. I've tried install 3.5 SP1 on the XP system, but it makes no difference if its installed or not installed.

    So to recap<br />
    My personal desktop...vista...VS2008 installed...works<br />

    My personal laptop...vista...VS2008 installed...works<br />

    My bros laptop...vista...VS2008 NOT installed...works<br />

    My church's laptop...7...VS2008 NOT installed...doesn't work.<br />

    The XP desktop...XP...VS 2008 NOT installed...doesn't work.<br />

    My sister's laptop...vista basic...VS 2008 NOT installed...doesn't work.<br /><br />


    I see no pattern at all...not even that it works on only vista. Because of my sis's laptop.
    Sunday, March 14, 2010 9:49 PM
  • I have put an MsgBox after the InitializeComponent and it doesn't show up. I can't put it before the InitializeComponent because then it says "Declaration Expected". I think we've narrowed down the problem to this InitializeComponent(). What exactly does InitializeComponent do anyway (besides initializing components =P)?

    And if I seemed offensive in earlier posts, I'm sorry for that. I guess I was just fed up over this problem =(
    Sunday, March 14, 2010 10:14 PM
  • I've thought of every possible way to give you guys source...and I finally know one, I'll simply post them on TWBP's site and give you the links. Sorry for not giving you guys source earlier...only thought of it now. Anyway. Form1.Designer.vb = http://twbp.bravehost.com/frm1_design.txt Form1.vb = http://twbp.bravehost.com/frm1.txt
    Sunday, March 14, 2010 10:51 PM
  • Colin,

    You weren't offensive, I think you're frustrated. I just didn't want you to think you're being ignored because you don't get an immediate response.

    What happens when you put the messagebox before InitializeComponent? What exactly is the error? This should work.

    Are you deploying the Visual Basic PowerPacks as a prerequisite, and did you install the application by running setup.exe (which installs the prerequisites) on the target machines? Or did you install the PowerPacks on the target machine?

    What version of .NET 2.0 is installed? If you go to C:\Windows\Microsoft.NET\Framework\v2.0.507020\ and look for mscorlib.dll, right-click and do Properties and go to the details tab, what version is it? For example, mine is 2.0.50727.4927.

    Are you deploying .NET 2.0 as a prerequisite? Are you deploying the version with SP-2 included (posted at the top of this forum) ?

    What is this reference: Kleinma.Controls.WebBrowserEx
    Are you deploying the dll or whatever it is that it requires, and is it deployed locally or in the GAC? Do you see it on the target machine?

    How about this one: dwmapi.dll

    RobinDotNet

    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by RobinDotNet Monday, March 15, 2010 10:47 PM
    • Unmarked as answer by RobinDotNet Monday, March 15, 2010 10:48 PM
    • Proposed as answer by RobinDotNet Monday, March 15, 2010 10:48 PM
    • Marked as answer by Aland Li Wednesday, March 17, 2010 9:21 AM
    Sunday, March 14, 2010 11:57 PM
  • If you mean the InitializeComponent in Form1.Designer.vb, I put the MsgBox in right before, and I try to build it but it says "declaration expected." I installed the powerpacks from a download link on Microsoft to the XP box. Didn't make a difference. .NET framework 2.0 is installed on all computers, and my installer will refuse to install it unless it detects .net framework 2.0 or higher. And lastly, my version of mscorlib.dll is 2.0.50727.4200. I'll check into the custom control.
    Monday, March 15, 2010 1:23 AM
  • Do all classes need DLLs, if so, that might be my problem. All I did was download the vb source file, added it as a class, then modified code on form1 and I was good to go.
    Monday, March 15, 2010 1:35 AM

  • Hi,

    Sorry, it's been a while since I've done VB instead of C#. Add a constructor to your form's code-behind (Form1.vb) and call InitializeComponent in there, and put the MsgBox before the call to InitializeComponent. In VB it uses a default constructor that calls InitializeComponent by default, unless you add your own.

    Public Sub New()
        MsgBox("Hi")
        InitializeComponent()
    End Sub

    (Any time you add a specific default form constructor, you have to include the call to InitializeComponent).

    I'm betting that the problem is somewhere in InitializeComponent, and it's with the custom component you are using.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Monday, March 15, 2010 1:43 AM
  • You mean copy and paste the code in form1.vb or form1.designer.vb, and where? Sorry, not experienced enough in VB
    Monday, March 15, 2010 1:54 AM

  • First, the dll's that I mentioned before must be available on the machine the application is running on. So if you're not including it in your deployment, and it is in your GAC (Global Assembly cache C:\Windows\assembly\), you need to either find a copy of the dll and include it with your deployment (which may or may not work) or install it in the GAC. Which dll are you talking about?

    Second, yes, copy and paste that code into form1.vb. Generally, it is not a good idea to edit designer code, because it can be regenerated and wipe out your changes. It is a constructor, which is called when the form is created. If you don't have one, it uses a default constructor (behind the scenes) which calls InitializeComponent by default. If you add one, it is used in place of the behind-the-scenes one. That's what you are doing here.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Monday, March 15, 2010 2:19 AM
  • I don't have any DLLs in my app, unless the custom class somehow creates one without my knowledge. As for the MsgBox, I put it in the code, and it doesn't popup the message box, but it does freeze the progam, I then right click on the taskbar and hit close to close the splash screen and BOOM crash. So I think whats happening is the messagebox is poping up, its just under the splash screen. If thats true, then it has to be InitializeComponent that's causing the crash.

    Thanks for all your help!
    Monday, March 15, 2010 2:29 AM
  • My guess is it's not finding this one at least: Kleinma.Controls.WebBrowserEx

    Where did that come from? Is there an install package for it?

    Also, I would turn the splash screen off and see if you can see the messagebox, just to make sure.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by RobinDotNet Monday, March 15, 2010 10:47 PM
    • Marked as answer by Aland Li Wednesday, March 17, 2010 9:21 AM
    Monday, March 15, 2010 3:58 AM
  • I think we've finally narrowed it down to something with InitializeComponent(). If the problem was before then, my message box wouldn't have shown up. And if it was after then, the program would have at least started and then crashed when I did something bad. The kleinma webbrowser came from a custom class which I downloaded, I then added it into my program as a class.
    Monday, March 15, 2010 12:23 PM
  • I replaced all webbrowserex's with just webbrowsers...still no cigar.
    Monday, March 15, 2010 12:42 PM
  • Whatever it does BEFORE InitializeComponent is the problem. I put an MsgBox RIGHT AFTER the sub. And it never showed. So something like this:

    InitializeComponent()
    MsgBox("this is a test")
    blablablablablabla
    blablabla
    blablabla
    blablabla
    blablabla
    blablabla
    blablabla
    End Sub


    So to recap:
    - I put an MsgBox in Form1.vb in public sub new right before InitializeComponent. It shows the messagebox.
    - I then put an MsgBox right after the Sub InitializeComponent in Form1.Designer.vb (shown above). And it crashes. Perhaps it can't call the function for some reason?

    Thanks,
    Colin (Alias "Simek")
    Monday, March 15, 2010 1:53 PM
  • YES!

    I have good news (I haven't fixed it though)...but I know what the problem is. I arbitrarily added another form with a button that shows form1. My theory was that if it crashed opening form16, then it was a dependency issue. If it opened form16, but then had trouble opening form1, it was obviously going to be something on form1. It didn't crash until form1. I pressed the show button, and PRESTO...IT GAVE ME THE EXACT ERROR...An error occured creating the form, see exception.innerexception for details. The error is: Could not load file or assembly 'Microsoft.VisualBasic.PowerPacks.Vs, Version 9.0.0.0 Culture=Neutral PublicKeyToken=b03f5f7f11d50a3a' or one of it's dependencies. The system cannot find the file specified. So I'm guessing if I install this DLL, the problem will go away. Do you know how I would go about doing that on my installer (not clickonce)? Thanks!

    P.S I think we finally have this thing sorted!
    Monday, March 15, 2010 6:15 PM
  • Even more good news...took out the lineshapes (plan to put them back in), and it fixed that error, only to give me another.

    Unable to load DLL dwmapi.dll. HRESULT 0x8007007E
    Monday, March 15, 2010 6:39 PM
  • Sorted Out!

    All I had to do was first take the lineshape out then remove the reference to Microsoft.VisualBasic.PowerPacks.Vs
    Then it had another error for me that said something about dwmapi.dll, which I realised was for my aero glass, I then just wrapped an if statement around the declaration to make sure it was vista or higher running.

    Thanks for ALL your help everyone, especially RobinDotNet. Finally after a year it's fixed. I am relieved to say the least! Going to repost on my other thread the answer for those "Inquiring Minds" as Frank puts it.

    P.S Feel free to try the web browser project. It's free, open source, and quick to install. You can find it at twbp.bravehost.com
    Monday, March 15, 2010 7:14 PM
  • You're welcome, Colin.

    If you really want to use the PowerPacks, you just need to deploy them as a prerequisite. If you're using ClickOnce or a setup & deployment package, go into the publish tab and click on the Prerequisites button. You should find the VB Power Packs in there, and be able to select it.

    If you're using your own deployment method, get the redistributable for the PowerPacks and deploy it as a prerequisite.

    Basically, anything you are referencing that is not an inherent part of the .NET Framework needs to be deployed and installed on the user's computer, or it won't run.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by Aland Li Wednesday, March 17, 2010 9:21 AM
    Monday, March 15, 2010 10:47 PM