File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,14 +24,18 @@ static NativeFileDialog()
2424
2525 foreach ( Type nativeProvider in nativeProviders )
2626 {
27- if ( Activator . CreateInstance ( nativeProvider ) is INativeDialogProvider provider )
27+ try
2828 {
29- if ( ! provider . CurrentPlatformSupported )
30- continue ;
31-
32- if ( _provider is null || _provider . Priority < provider . Priority )
33- _provider = provider ;
29+ if ( Activator . CreateInstance ( nativeProvider ) is INativeDialogProvider provider )
30+ {
31+ if ( ! provider . CurrentPlatformSupported )
32+ continue ;
33+
34+ if ( _provider is null || _provider . Priority < provider . Priority )
35+ _provider = provider ;
36+ }
3437 }
38+ catch { }
3539 }
3640 }
3741
Original file line number Diff line number Diff line change 11using Gdk ;
22using Gtk ;
33using System ;
4+ using System . Diagnostics ;
45
56namespace SharpFileDialog . NativeProviders
67{
@@ -100,11 +101,21 @@ static void ThrowOnPlatformUnsupported()
100101
101102 static bool InitCheck ( )
102103 {
103- string [ ] args = Environment . GetCommandLineArgs ( ) ;
104- string name = args . Length > 0 ? args [ 0 ] : string . Empty ;
105- string [ ] gtkArgs = Array . Empty < string > ( ) ;
104+ try
105+ {
106+ string [ ] args = Environment . GetCommandLineArgs ( ) ;
107+ string name = args . Length > 0 ? args [ 0 ] : string . Empty ;
108+ string [ ] gtkArgs = Array . Empty < string > ( ) ;
106109
107- return Application . InitCheck ( name , ref gtkArgs ) ;
110+ return Application . InitCheck ( name , ref gtkArgs ) ;
111+ }
112+ catch ( Exception e )
113+ {
114+ #if DEBUG
115+ Debug . WriteLine ( e ) ;
116+ #endif
117+ return false ;
118+ }
108119 }
109120
110121 static void SetDefaultPath ( IFileChooser widget , string path )
You can’t perform that action at this time.
0 commit comments