@@ -133,8 +133,19 @@ public override string GetConnectionDescription(IConnectionInfo cxInfo)
133133
134134 public override bool ShowConnectionDialog ( IConnectionInfo cxInfo , bool isNewConnection )
135135 {
136- var properties = new TxProperties ( cxInfo ) ;
137- return new ConnectionDialog ( properties , _parserRegistry . Filter ) . ShowDialog ( ) ?? false ;
136+ try
137+ {
138+ var properties = new TxProperties ( cxInfo ) ;
139+ return new ConnectionDialog ( properties , _parserRegistry . Filter ) . ShowDialog ( ) ?? false ;
140+ }
141+ catch ( Exception error )
142+ {
143+ TxEventSource . Log . TraceError ( error . ToString ( ) ) ;
144+
145+ MessageBox . Show ( error . ToString ( ) , "ShowConnectionDialog" ) ;
146+
147+ return false ;
148+ }
138149 }
139150
140151 public override ParameterDescriptor [ ] GetContextConstructorParameters ( IConnectionInfo cxInfo )
@@ -301,19 +312,26 @@ public override void OnQueryFinishing(IConnectionInfo cxInfo, object context, Qu
301312
302313 private static Assembly AssemblyResolve ( object sender , ResolveEventArgs args )
303314 {
304- string assemblyname = args . Name . Substring ( 0 , args . Name . IndexOf ( ',' ) ) + ".dll" ;
305- string driverDir = Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) ;
306- IEnumerable < string > assemblies = Directory . EnumerateFiles ( driverDir , assemblyname ) ;
307- foreach ( string path in assemblies )
315+ try
308316 {
309- return Assembly . LoadFrom ( path ) ;
310- }
317+ string assemblyname = args . Name . Substring ( 0 , args . Name . IndexOf ( ',' ) ) + ".dll" ;
318+ string driverDir = Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) ;
319+ IEnumerable < string > assemblies = Directory . EnumerateFiles ( driverDir , assemblyname ) ;
320+ foreach ( string path in assemblies )
321+ {
322+ return DataContextDriver . LoadAssemblySafely ( path ) ;
323+ }
311324
312- string root = Path . Combine ( Path . GetTempPath ( ) , @"LINQPad\" ) ;
313- assemblies = Directory . EnumerateFiles ( root , assemblyname , SearchOption . AllDirectories ) ;
314- foreach ( string path in assemblies )
325+ string root = Path . Combine ( Path . GetTempPath ( ) , @"LINQPad\" ) ;
326+ assemblies = Directory . EnumerateFiles ( root , assemblyname , SearchOption . AllDirectories ) ;
327+ foreach ( string path in assemblies )
328+ {
329+ return DataContextDriver . LoadAssemblySafely ( path ) ;
330+ }
331+ }
332+ catch ( Exception error )
315333 {
316- return Assembly . LoadFrom ( path ) ;
334+ TxEventSource . Log . TraceError ( error . ToString ( ) ) ;
317335 }
318336
319337 return null ;
0 commit comments