3
3
// See the LICENSE file in the project root for more information.
4
4
using System ;
5
5
using HostsUILib . Helpers ;
6
- using HostsUILib . HostsService ;
6
+ // using HostsUILib.HostsService;
7
7
8
8
namespace Hosts . FuzzTests
9
9
{
@@ -19,7 +19,7 @@ public static void FuzzValidIPv4(ReadOnlySpan<byte> input)
19
19
20
20
// Console.WriteLine($"Input:{address}, ValidIPv4:{isValid}");
21
21
}
22
- catch ( Exception ex ) when ( ex is ArgumentException )
22
+ catch ( Exception ex )
23
23
{
24
24
// This is an example. It's important to filter out any *expected* exceptions from our code here.
25
25
// However, catching all exceptions is considered an anti-pattern because it may suppress legitimate
@@ -39,7 +39,7 @@ public static void FuzzValidIPv6(ReadOnlySpan<byte> input)
39
39
40
40
// Console.WriteLine($"Input:{address}, ValidIPv6:{isValid}");
41
41
}
42
- catch ( Exception ex ) when ( ex is ArgumentException )
42
+ catch ( Exception ex )
43
43
{
44
44
// This is an example. It's important to filter out any *expected* exceptions from our code here.
45
45
// However, catching all exceptions is considered an anti-pattern because it may suppress legitimate
@@ -58,7 +58,7 @@ public static void FuzzValidHosts(ReadOnlySpan<byte> input)
58
58
59
59
// Console.WriteLine($"Input:{hosts}, ValidHosts:{isValid}");
60
60
}
61
- catch ( Exception ex ) when ( ex is ArgumentException )
61
+ catch ( Exception ex ) when ( ex is OutOfMemoryException )
62
62
{
63
63
// This is an example. It's important to filter out any *expected* exceptions from our code here.
64
64
// However, catching all exceptions is considered an anti-pattern because it may suppress legitimate
@@ -69,15 +69,15 @@ public static void FuzzValidHosts(ReadOnlySpan<byte> input)
69
69
}
70
70
71
71
//
72
- public static void FuzzWriteAsync ( ReadOnlySpan < byte > input )
73
- {
74
- var additionalLines = System . Text . Encoding . UTF8 . GetString ( input ) ;
75
- var entries = new List < Entry > ( ) ;
76
- entries . Add ( new Entry ( 0 , System . Text . Encoding . UTF8 . GetString ( input ) ) ) ;
77
- HostsService . WriteAsync ( additionalLines , entries ) . Wait ( ) ;
72
+ // public static void FuzzWriteAsync(ReadOnlySpan<byte> input)
73
+ // {
74
+ // var additionalLines = System.Text.Encoding.UTF8.GetString(input);
75
+ // var entries = new List<Entry>();
76
+ // entries.Add(new Entry(0, System.Text.Encoding.UTF8.GetString(input)));
77
+ // HostsService.WriteAsync(additionalLines, entries).Wait();
78
78
79
79
80
- }
80
+ // }
81
81
82
82
}
83
83
}
0 commit comments