-
Aug 7th, 2008, 03:08 PM
#1
Thread Starter
Hyperactive Member
[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.
-
Aug 7th, 2008, 03:26 PM
#2
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.
-
Aug 7th, 2008, 03:48 PM
#3
Thread Starter
Hyperactive Member
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...
)
-
Aug 7th, 2008, 03:55 PM
#4
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?
-
Aug 7th, 2008, 04:04 PM
#5
Thread Starter
Hyperactive Member
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:
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.
-
Aug 7th, 2008, 04:07 PM
#6
Thread Starter
Hyperactive Member
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:
-
Aug 7th, 2008, 04:23 PM
#7
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
-
Aug 7th, 2008, 04:27 PM
#8
Thread Starter
Hyperactive Member
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...
-
Aug 7th, 2008, 06:08 PM
#9
Thread Starter
Hyperactive Member
Re: [2008] CLR20r3 Error
Nope, still no luck
-
Aug 10th, 2008, 03:42 AM
#10
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?
-
Aug 10th, 2008, 05:02 AM
#11
Thread Starter
Hyperactive Member
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.
-
Aug 10th, 2008, 05:25 AM
#12
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.
-
Aug 11th, 2008, 11:16 AM
#13
Thread Starter
Hyperactive Member
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
-
Aug 11th, 2008, 11:28 AM
#14
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|