[RESOLVED] [2008] CLR20r3 Error-VBForums
Results 1 to 14 of 14

Thread: [RESOLVED] [2008] CLR20r3 Error

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Norwich, UK.
    Posts
    304

    Resolved [RESOLVED] [2008] CLR20r3 Error

    Hi, I've written a fairly simple app that connects to a SQL server and pulls data to a DataGridView with a few textboxes that are also databound. When running on the Dev PC, it works fine. When running on any other PC (with .NET3.5 etc etc) it crashes at startup with the default 'do you want to send to Microsoft' error.

    The details of the error are:

    EventType: clr20r3 P1: <app name> P2: 4.0.0.0 P3: 489b45dc5 P4: <app name> P5: 4.0.0.0 P6: 489b4dc5 P7: 2b P8: c6 P9: system.invalidoperationexception.

    I can't find the cause of the problem. There are no errors or warnings in the application and I have error handling on the form startup event.

    Anyone know why this is happening?

    Saw some articles about stack traces etc and adding exceptions but this is way beyond my capabilities. I'll be pretty jarred off if this app won't work on other PC's as it's a waste of 2 months work (sigh).

    Thanks.
    Shifty.

  2. #2
    Moderator.NET kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,203

    Re: [2008] CLR20r3 Error

    I am sure if it works on your dev box, then you can get it to work on the other PCs.

    The first thing to do would be to try to identify anything different about the PCs having trouble.

    1) Are you running the exe from a network location on these machines? That can cause problems if CAS is not configured properly.

    2) Are you running this as a "single instance application"? If so, there is a chance that this may be your problem

    3) If neither of those are it, then I would suggest you try to create a very simple exe that is just a form with a button, and when you click the button it opens a database connection to the SQL Server, and then closes it. If this works, then you know you can track your issue to something else. If you can't even get a very basic program working, then there may be more going on.
    Using VS.NET 2013/.NET 2.0 through 4.5 * Please mark you thread resolved using the Thread Tools above
    PLEASE INDICATE WHAT VERSION OF VB YOU USE!!!!!!!!!!!
    * If you found a post useful then please Rate it! * DO NOT PM ME WITH LINKS TO YOUR THREADS FOR ANSWERS PLEASE!

    Code Bank:Manipulate HTML Page content in the Web Browser Control from VB - Drag Drop from Windows into Win Form - Launch new default browser instance to open URL - Display Internet Image in Picturebox - Download Files From Web With Progress Bar - IP Textbox User Control - Installing .NET Framework with INNO Setup
    ZerosAndTheOne.com
    -=Matt=-

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Norwich, UK.
    Posts
    304

    Re: [2008] CLR20r3 Error

    1) No, exe is on the local clients.

    2) I know what you mean, but can't remember - it's left at the default setting, whatever that is. I haven't changed it.

    3) Other apps that I have developed work ok on these other machines.

    4) I'm going to cry...

    )

  4. #4
    Moderator.NET kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,203

    Re: [2008] CLR20r3 Error

    what OS are the target machines? Same as your dev box?

    Is your .NET app targetting 3.5 specifically or is it targetting .NET 2.0?
    Using VS.NET 2013/.NET 2.0 through 4.5 * Please mark you thread resolved using the Thread Tools above
    PLEASE INDICATE WHAT VERSION OF VB YOU USE!!!!!!!!!!!
    * If you found a post useful then please Rate it! * DO NOT PM ME WITH LINKS TO YOUR THREADS FOR ANSWERS PLEASE!

    Code Bank:Manipulate HTML Page content in the Web Browser Control from VB - Drag Drop from Windows into Win Form - Launch new default browser instance to open URL - Display Internet Image in Picturebox - Download Files From Web With Progress Bar - IP Textbox User Control - Installing .NET Framework with INNO Setup
    ZerosAndTheOne.com
    -=Matt=-

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Norwich, UK.
    Posts
    304

    Re: [2008] CLR20r3 Error

    All OS's are XP Pro. All have .NET 3.5 installed and the app is targetting the defaults for VB2008.

    However, have just moved the project to my laptop (also with VB2008) and ran it in the dev studio there, now appear to be getting an error in the compiler which might shed more light...


    vb Code:
    1. An error occurred creating the form. See Exception.InnerException for details.  The error is: Format of the initialization string does not conform to specification starting at index 25.

    Not sure what this means tho. If I click 'go to code' it shows some of the hidden auto-generated code but doesn't squiggle-underline the problem bit so I have no idea how to even go about fixing.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Norwich, UK.
    Posts
    304

    Re: [2008] CLR20r3 Error

    Hmmmmmmm here's the full error. I should add this first became a problem when I changed the Application Settings data connection string from SQLExpress to the live DB, then re-compiled. Worked ok in Dev but not on standalone.

    Here's the full error:

    System.InvalidOperationException was unhandled
    Message="An error occurred creating the form. See Exception.InnerException for details. The error is: Format of the initialization string does not conform to specification starting at index 25."
    Source="MR IT Inventory 4.0.0"
    StackTrace:
    at MR_IT_Inventory_4._0._0.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
    at MR_IT_Inventory_4._0._0.My.MyProject.MyForms.get_Form1()
    at MR_IT_Inventory_4._0._0.My.MyApplication.OnCreateMainForm() in C:\Users\Andrew\Documents\Visual Studio 2008\Projects\MR IT Inventory 4.0.0_new\MR IT Inventory 4.0.0\My Project\Application.Designer.vb:line 35
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    at MR_IT_Inventory_4._0._0.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    InnerException: System.ArgumentException
    Message="Format of the initialization string does not conform to specification starting at index 25."
    Source="System.Data"
    StackTrace:
    at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)
    at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)
    at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)
    at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
    at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
    at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
    at System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value)
    at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
    at MR_IT_Inventory_4._0._0.dsPoolDevicesTableAdapters.MR_BlackBerryTableAdapter.InitConnection() in C:\Users\Andrew\Documents\Visual Studio 2008\Projects\MR IT Inventory 4.0.0_new\MR IT Inventory 4.0.0\dsPoolDevices.Designer.vb:line 4737
    at MR_IT_Inventory_4._0._0.dsPoolDevicesTableAdapters.MR_BlackBerryTableAdapter.get_Connection() in C:\Users\Andrew\Documents\Visual Studio 2008\Projects\MR IT Inventory 4.0.0_new\MR IT Inventory 4.0.0\dsPoolDevices.Designer.vb:line 4552
    at MR_IT_Inventory_4._0._0.dsPoolDevicesTableAdapters.TableAdapterManager.set_MR_BlackBerryTableAdapter (MR_BlackBerryTableAdapter Value) in C:\Users\Andrew\Documents\Visual Studio 2008\Projects\MR IT Inventory 4.0.0_new\MR IT Inventory 4.0.0\dsPoolDevices.Designer.vb:line 8584
    at MR_IT_Inventory_4._0._0.Form1.InitializeComponent() in C:\Users\Andrew\Documents\Visual Studio 2008\Projects\MR IT Inventory 4.0.0_new\MR IT Inventory 4.0.0\Form1.Designer.vb:line 900
    at MR_IT_Inventory_4._0._0.Form1..ctor() in C:\Users\Andrew\Documents\Visual Studio 2008\Projects\MR IT Inventory 4.0.0_new\MR IT Inventory 4.0.0\Form1.vb:line 3
    InnerException:

  7. #7
    PowerPoster
    Join Date
    May 2002
    Posts
    25,160

    Re: [2008] CLR20r3 Error

    Jsut taking a wild stab here.... but did you include the config file with it? It''ll need to be the one in the bin folder called "yourappname.exe.config" ....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Norwich, UK.
    Posts
    304

    Re: [2008] CLR20r3 Error

    Not tried that on the pc's where it crashes.... but why won't it open in Visual Studio on a different PC? ie: the project contains the config file...

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Norwich, UK.
    Posts
    304

    Re: [2008] CLR20r3 Error

    Nope, still no luck

  10. #10
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,448

    Re: [2008] CLR20r3 Error

    My guess is that the "Format of the initialization string does not conform to specification" error is because of a malformed connection string. Can we have a look at your database connection string after you *** out sensitive information?
    "Feel the force...read the source..."
    Utilities: POPFile DebugView Process Explorer Wireshark KeePass UltraVNC Pic2Ascii
    .Net tools & open source: DotNetNuke log4Net CLRProfiler
    My open source projects: Thales Simulator EFT Calculator System Info Reporter VSS2SVN IBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Norwich, UK.
    Posts
    304

    Re: [2008] CLR20r3 Error

    The application looked in such a mess I just re-wrote the whole thing from scratch. It's bloody annoying, because all I did was....

    1) Wrote the app for SQLExpress
    2) Added DataGridViews by drag/drop then reconfigured the grid as required
    3) Tested & debugged - ready to go live
    4) Project | Application Properties - amended the existing connection string from SQL Express to SQL Server.

    Copies of the strings below:

    ORIGINAL CONNECTION STRING:

    Data Source=.\SQLEXPRESS;AttachDbFilename=""C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\InventoryDB.mdf"";Integrated Security=True;Connect Timeout=30;User Instance=True

    MODIFIED CONNECTION STRING:

    Data Source=******;Initial Catalog=InventoryDB;Persist Security Info=True;User ID=sa;Password=******

    The SQL Server DB schema was scripted from the original DB on SQLExpress so the tables, primary keys etc etc are all identical.

    There are no hard-coded connections so I assumed all I had to do was change the connection string in the properties. The app ran correctly on the development pc but as soon as I tried to run it on another box it got the MS error.

    How else am I supposed to change from the test DB to the live DB?

    In the past I have left the connection string the same, merely changing the server name and password (when the test server has been a full blown SQL server rather than SQL Express). Am I better off testing on SQL Server and forgetting SQL Express as I think this is the problem.

  12. #12
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,448

    Re: [2008] CLR20r3 Error

    The connection string looks good to me.
    Quick question though, can you show what you have right after "Data Source=" instead of the * characters?

    EDIT: And your password doesn't include a ; BTW?
    Last edited by ntg; Aug 10th, 2008 at 05:35 AM.
    "Feel the force...read the source..."
    Utilities: POPFile DebugView Process Explorer Wireshark KeePass UltraVNC Pic2Ascii
    .Net tools & open source: DotNetNuke log4Net CLRProfiler
    My open source projects: Thales Simulator EFT Calculator System Info Reporter VSS2SVN IBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Norwich, UK.
    Posts
    304

    Re: [2008] CLR20r3 Error

    Data Source=ServerName (ie I am not typing my server name so you'll have to improvise) Password=password (again, not disclosing that info!).

    Although this isn't the fix for my problem I think I know what caused it all.

    I don't think you can change application settings (connection strings) if you have dragged/dropped databound components onto forms.

    Although, I have found a perfect way to overcome my issue of (a) developing with SQL Express and (b) changing the connection strings to deploy to the live SQL Server.

    Check this out: http://msdn.microsoft.com/en-gb/vbasic/cc307956.aspx

    You basically go to Application Settings, press F7 to load the code editor then add an Event Property for 'MySettingsEvents' and select the 'SettingsLoaded' event handler.

    Then add some code as per the sample below - this allows you to dynamically change the connection string at runtime (note the ConnectionString name must match EXACTLY what you have in the Application Settings.

    This sample is for my hard-coded SQL Server, but changing it to SQL Express at runtime for Dev work. Once I have finished, simply comment out all the below and the app reverts to the live connection string.

    Perfect!

    Code:
    Namespace My
        
        'This class allows you to handle specific events on the settings class:
        ' The SettingChanging event is raised before a setting's value is changed.
        ' The PropertyChanged event is raised after a setting's value is changed.
        ' The SettingsLoaded event is raised after the setting values are loaded.
        ' The SettingsSaving event is raised before the setting values are saved.
        Partial Friend NotInheritable Class MySettings
    
            Public WriteOnly Property RuntimeConnectionString() As String
                Set(ByVal value As String)
    
                    My.Settings("InventoryDBConnectionString") = value
    
                End Set
            End Property
    
            Private Sub MySettings_SettingsLoaded(ByVal sender As Object, ByVal e As System.Configuration.SettingsLoadedEventArgs) Handles Me.SettingsLoaded
    
                Me.Item("InventoryDBConnectionString") = "Data Source=.\SQLEXPRESS;AttachDbFilename=""C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\InventoryDB.mdf"";Integrated Security=True;Connect Timeout=30;User Instance=True"
    
            End Sub
        End Class
    End Namespace

  14. #14
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,448

    Re: [2008] CLR20r3 Error

    I think you nailed it all by yourself
    The ; in the ".\SQLEXPRESS;" is at index position 25 and it's not legal for an SQL connection.
    "Feel the force...read the source..."
    Utilities: POPFile DebugView Process Explorer Wireshark KeePass UltraVNC Pic2Ascii
    .Net tools & open source: DotNetNuke log4Net CLRProfiler
    My open source projects: Thales Simulator EFT Calculator System Info Reporter VSS2SVN IBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.