C# packager issues
jbrown
Posts: 20
I noticed a few annoyances in the C# packager.
#1
In FormAbout, linkLabel1_LinkClicked, if you change the hypertext to point to "yourcompany.com", you must also change this:
string text2LookFor = "yourcompany.com"
if you don't, the click area will start at -1 because it's assumed that the "text to look for" is always found.
#2
... then at run time you get a very weird error in packagemain.cs, showmsg:
if(m_ConsoleMode) //Console
{
Console.WriteLine("\n\n"+msgTypeText);
Console.Write(message + "\r\n");
because the error is in the coding (string text2lookfor is never found), m_ConsoleMode is not properly initialized, the application thinks its running in console mode, and it throws an IOException.
#3
When you first open PackageExecutor.cs in VS, you'll receive an error stating that the line endings are inconsistent, and VS prompts you to convert all line endings to CR LF.
#4
In FormSelectDatabase, textBoxInformation, the Text property reads:
"This executable will upgrade an existing database or create a new database. Please choose the server and database you would like to upgrade or create."
Changing it in the text box's properties does little good however, unless you deal with this:
if(this.radioButtonUpgradeDatabase.Checked)
this.textBoxInformation.Text = "This executable will upgrade an existing database. Please choose the server and database you would like to upgrade.";
else
this.textBoxInformation.Text = "This executable will create a new database. Please choose the server and database you would like to create.";
(You never see the text that displays from the textBox's properties, in other words, because it's always overwritten by one or the other of these nearly identical variants).
Not strictly C# issues:
# 5
if you include users in your package and you choose to "upgrade an existing database", the package will error because the users already exist.
# 6
the database settings are not available in the packager: specifically we need to be able to "SET trustworthy ON" during database creation.
#1
In FormAbout, linkLabel1_LinkClicked, if you change the hypertext to point to "yourcompany.com", you must also change this:
string text2LookFor = "yourcompany.com"
if you don't, the click area will start at -1 because it's assumed that the "text to look for" is always found.
#2
... then at run time you get a very weird error in packagemain.cs, showmsg:
if(m_ConsoleMode) //Console
{
Console.WriteLine("\n\n"+msgTypeText);
Console.Write(message + "\r\n");
because the error is in the coding (string text2lookfor is never found), m_ConsoleMode is not properly initialized, the application thinks its running in console mode, and it throws an IOException.
#3
When you first open PackageExecutor.cs in VS, you'll receive an error stating that the line endings are inconsistent, and VS prompts you to convert all line endings to CR LF.
#4
In FormSelectDatabase, textBoxInformation, the Text property reads:
"This executable will upgrade an existing database or create a new database. Please choose the server and database you would like to upgrade or create."
Changing it in the text box's properties does little good however, unless you deal with this:
if(this.radioButtonUpgradeDatabase.Checked)
this.textBoxInformation.Text = "This executable will upgrade an existing database. Please choose the server and database you would like to upgrade.";
else
this.textBoxInformation.Text = "This executable will create a new database. Please choose the server and database you would like to create.";
(You never see the text that displays from the textBox's properties, in other words, because it's always overwritten by one or the other of these nearly identical variants).
Not strictly C# issues:
# 5
if you include users in your package and you choose to "upgrade an existing database", the package will error because the users already exist.
# 6
the database settings are not available in the packager: specifically we need to be able to "SET trustworthy ON" during database creation.
Comments
when editing the package templates (SQL Packager 5\SQL Packager Code Templates), you cannot open the designer for MessageBox.cs. Error says "The variable 'messageBoxIcon1' is either undeclared or was never assigned. "
#8
if you encounter a SQL error when building a new database (e.g. a database the same name already exists, etc.) the application attempts a catch and then blows up at PackageExecutor.cs, Execute() at "throw;":
public void Execute()
{
try
{
OnStatus(new ProgressStatusEventArgs("Connecting To Database", 0));
ConnectToDatabase(); //Connect to database
ExecutePackage();
}
catch //If any exception then potentially delete the database if I made it///
{
DeleteDatabaseIfMade();
throw;
}
}
If you haven't received the e-mail from Chris, this has been logged in our bug tracking software and will be reviewed for the next release.
Thanks,
Redgate Foundry