File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed
test-applications/nuget-packages/TestApplication.NugetSample Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,16 @@ private static void ChangeDefaultProgramToHttpClient()
6565 {
6666 const string ProgramContent = @"
6767using var httpClient = new HttpClient();
68- httpClient.Timeout = TimeSpan.FromSeconds(5);
69- using var response = await httpClient.GetAsync(""http://example.com"");
70- Console.WriteLine(response.StatusCode);
68+ httpClient.Timeout = TimeSpan.FromSeconds(10);
69+ try
70+ {
71+ var response = await httpClient.GetAsync(""http://example.com"");
72+ Console.WriteLine(response.StatusCode);
73+ }
74+ catch (Exception e)
75+ {
76+ Console.WriteLine(e);
77+ }
7178" ;
7279
7380 File . WriteAllText ( "Program.cs" , ProgramContent ) ;
Original file line number Diff line number Diff line change 1818using System . Net . Http ;
1919#endif
2020
21- var httpClient = new HttpClient ( ) ;
22- httpClient . Timeout = TimeSpan . FromSeconds ( 5 ) ;
23- var response = await httpClient . GetAsync ( "http://example.com" ) ;
24- Console . WriteLine ( response . StatusCode ) ;
21+ using var httpClient = new HttpClient ( ) ;
22+ httpClient . Timeout = TimeSpan . FromSeconds ( 10 ) ;
23+ try
24+ {
25+ var response = await httpClient . GetAsync ( "http://example.com" ) ;
26+ Console . WriteLine ( response . StatusCode ) ;
27+ }
28+ catch ( Exception e )
29+ {
30+ Console . WriteLine ( e ) ;
31+ }
You can’t perform that action at this time.
0 commit comments