Pavan,

Error is a generic SQL Exception 

Property(C): EXCEPTIONDETAILS = System.Data.SqlClient.SqlException 
(0x80131904): Login failed for user 'Username_user'.
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException 
exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand 
cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, 
TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean 
enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo 
serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer 
timeout, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo 
serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection 
owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
   at 
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection 
owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, 
String newPassword, Boolean redirectedUserInstance)
   at 
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity 
identity, SqlConnectionString connectionOptions, Object providerInfo, String 
newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at 
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions 
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection 
owningConnection)
   at 
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
 owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection 
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection 
owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection 
owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection 
owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection 
outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at CustomActions.GetDBVersion(Session session)
=== Logging stopped: 3/18/2014  15:51:54 ===

Regards,

> From: pavan.kond...@accelrys.com
> To: wix-users@lists.sourceforge.net
> Date: Tue, 18 Mar 2014 18:45:08 -0700
> Subject: Re: [WiX-users] Custom Action error Handling in Wix 3.7
> 
> Hi Alan,
> 
> Can you post the error message that you see in the log?
> 
> --Pavan
> 
> -----Original Message-----
> From: Alan Smith [mailto:the_red_baro...@hotmail.com] 
> Sent: Tuesday, March 18, 2014 4:56 PM
> To: wix-users@lists.sourceforge.net
> Subject: [WiX-users] Custom Action error Handling in Wix 3.7
> 
> I think this is an issue with how I am implementing my custom action, but I 
> am looking for some assistance with an issue I have encountered.
> 
> I have built a number of C# (.NET 4) Custom Actions which all reside in a 
> single DLL file. I am able to call all of these actions successfully and the 
> processing logic runs as expected, unless an exception is encountered. 
> Whenever an exception is encountered the custom action fails causing the 
> whole installation to roll back without ever entering my catch block. I have 
> witnessed this behaviour with a number of the actions that are scheduled to 
> run during the UI sequence (immediate type 1 custom actions). The below 
> details are for a specific new action I am developing to try and A: Verify 
> correct connection details for a database and B: Retrieve a version number 
> from the database. I am not looking for assistance with the C# code itself, 
> but as to why the error handling is not firing when run via WiX.
> 
> Below is my scheduling and C# code. Can anyone provide an explanation as to 
> why the exception handling is not being called? I have vetted my code with my 
> .NET developer colleagues and they are at a loss to explain it as well. I 
> have even added in the explicit SQL Exception handling (my error handling 
> does not need to be this precise) with no affect.
> 
> Using WiX 3.7 with Visual Studio 2010.
> 
> C# Code:
>     [CustomAction]
>     public static ActionResult GetDBVersion(Session session)
>     {
>         try
>         {
>             session.Log("Begin retrieval of version number");
>             string inputConnString = session["INPUT_CONN_STRING"];
>             string dbConnectionString = "";
>             if (string.IsNullOrEmpty(inputConnString))
>             {
>                 string dataSource = session["INPUT_SQL_SERVER"];
>                 string DBName = session["INPUT_DB_NAME"];
>                 string User = session["INPUT_USER_NAME"];
>                 string Password = session["INPUT_PASSWORD"];
>                 if (!string.IsNullOrEmpty(dataSource) && 
> !string.IsNullOrEmpty(DBName) && !string.IsNullOrEmpty(User) && 
> !string.IsNullOrEmpty(Password))
>                 {
>                     dbConnectionString = String.Format("Data 
> Source={0};Initial Catalog={1};Persist Security Info=True;User 
> ID={2};Password={3};", dataSource.ToString().Replace("^", ","), DBName, User, 
> Password);
>                 }
>             }
>             else if (!string.IsNullOrWhiteSpace(inputConnString))
>             {
>                 dbConnectionString = inputConnString;
>             }
>             else
>             {
>                 throw new System.ApplicationException("Invalid Database 
> Connection String details");
>             }
>             string checkVersionCommand = "select Max(Replace(Version, 
> 'AppName', '')) from Version";
>             using (SqlConnection conn = new SqlConnection(dbConnectionString))
>             {
>                 conn.Open();
>                 using (SqlCommand cmd = new SqlCommand(checkVersionCommand, 
> conn))
>                 using (SqlDataReader rdr = cmd.ExecuteReader())
>                 {
>                     if (rdr.HasRows)
>                     {
>                         string databaseVersion = rdr.GetString(0);
>                         session["DATABASE_VERSION"] = databaseVersion;
>                     }
>                     else
>                     {
>                         session["DATABASE_VERSION"] = "NONE";
>                     }
>                 }
>             }
>         }
>         catch (System.Data.SqlClient.SqlException ex)
>         {
>             session.Log("ERROR in custom action GetDBVersion {0}",
>             ex.ToString());
>             session["EXCEPTIONDETAILS"] = ex.ToString();
>             string dir = session["CURRENTDIRECTORY"];
>             string filepath = dir + "\\Logs\\CustomAction.log";
>             File.AppendAllText(filepath, "ERROR in custom action GetDBVersion 
> - " + ex.ToString() + "\n");
>             session["DATABASE_VERSION"] = "ERROR";
>         }
>         catch (Exception ex)
>         {
>             session.Log("ERROR in custom action GetDBVersion-Generic {0}",
>             ex.ToString());
>             session["EXCEPTIONDETAILS"] = ex.ToString();
>             string dir = session["CURRENTDIRECTORY"];
>             string filepath = dir + "\\Logs\\CustomAction.log";
>             File.AppendAllText(filepath, "ERROR in custom action 
> GetDBVersion-Generic - " + ex.ToString() + "\n");
>             session["DATABASE_VERSION"] = "ERROR";
>         }
>         return ActionResult.Success;
>     }
> 
> CustomAction definition within WXS:
>     <CustomAction Id="A.GetDatabaseVersion" Return="check" 
> Execute="immediate" BinaryKey="CustomActions" DllEntry="GetDBVersion" /> 
> 
> Custom Action Scheduling within UI Sequence
>     <UI>
>         <Dialog Id="SQLUserLoginDlg" Width="370" Height="270" 
> Title="!(loc.SQLUserLoginDlg_DialogTitle)">
>             <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" 
> Height="17" Default="yes" Text="!(loc.WixUINext)">
> 
>                 
>                 <!-- Actions for Database version checking etc -->
>                 <Publish Event="DoAction" Value="A.SetInputSQLServer" 
> Order="10">1</Publish>
>                 <Publish Event="DoAction" Value="A.SetInputSQLDBName" 
> Order="10">1</Publish>
>                 <Publish Event="DoAction" Value="A.SetInputSQLUser" 
> Order="10">1</Publish>
>                 <Publish Event="DoAction" Value="A.SetInputSQLPassword" 
> Order="10">1</Publish>
>                 <Publish Event="DoAction" Value="A.GetDatabaseVersion" 
> Order="11">1</Publish> ...
> 
> Thanks.
> 
> Regards.
>                                         
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the 
> definitive new guide to graph databases and their applications. Written by 
> three acclaimed leaders in the field, this first edition is now available. 
> Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> 
> 
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
                                          
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to