Skip to content

Commit 62ce013

Browse files
committed
Merge branch 'main' of github.com:dotnet/dotnet-api-docs into gewarren-modernize-system-diagnostics
2 parents 7c3205e + 7f90ef5 commit 62ce013

78 files changed

Lines changed: 8635 additions & 8621 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Preview link generator'
1+
name: 'OPS build reporter'
22

33
on:
44
pull_request_target:
@@ -8,19 +8,21 @@ permissions:
88
contents: read
99

1010
jobs:
11-
preview_link_generator_job:
12-
name: Generate preview link table
11+
ops_build_reporter_job:
12+
name: Add preview links to PR body and annotate files with build warnings
1313
runs-on: ubuntu-latest
1414
permissions:
1515
statuses: read
16+
checks: write
1617
pull-requests: write
1718
steps:
1819
- name: Harden Runner
19-
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
20+
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
2021
with:
2122
egress-policy: audit
2223

23-
- uses: dotnet/docs-tools/actions/preview-link-generator@main
24+
- uses: dotnet/docs-tools/actions/ops-build-reporter@main
2425
with:
2526
repo_token: ${{ secrets.GITHUB_TOKEN }}
2627
max_wait_time_minutes: 40
28+
annotate_file_warnings: true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
> [!WARNING]
2+
> This method must be used only on trusted archives as it doesn't enforce any size limits, entry count limits, or other policies needed for safe extraction of untrusted archives. For more information on safely extracting archives from untrusted sources, see [Best practices for using zip and tar archives](/dotnet/standard/io/zip-tar-best-practices).

snippets/csharp/System.ComponentModel.Composition.Hosting/CompositionContainer/Compose/program.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
52
using System.ComponentModel.Composition;
63
using System.ComponentModel.Composition.Hosting;
74
using System.ComponentModel.Composition.Primitives;
@@ -12,7 +9,7 @@ namespace ConsoleApplication5
129
[Export]
1310
class Part1
1411
{
15-
public String data = "This is the example data!";
12+
public string data { get; } = "This is the example data!";
1613
}
1714

1815
[Export]
@@ -31,16 +28,16 @@ class Part3
3128

3229
class Program
3330
{
34-
static void Main(string[] args)
31+
static void Main()
3532
{
36-
CompositionContainer container = new CompositionContainer();
37-
CompositionBatch batch = new CompositionBatch();
33+
CompositionContainer container = new();
34+
CompositionBatch batch = new();
3835
batch.AddPart(AttributedModelServices.CreatePart(new Part1()));
3936
batch.AddPart(AttributedModelServices.CreatePart(new Part2()));
4037
batch.AddPart(AttributedModelServices.CreatePart(new Part3()));
4138
container.Compose(batch);
42-
Part3 _part = container.GetExportedValue<Part3>();
43-
Console.WriteLine(_part.data.data.data);
39+
Part3 part = container.GetExportedValue<Part3>();
40+
Console.WriteLine(part.data.data.data);
4441
Console.ReadLine();
4542
}
4643
}

snippets/csharp/System.ComponentModel.Composition.Hosting/CompositionContainer/Overview/program.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
52
using System.ComponentModel.Composition;
63
using System.ComponentModel.Composition.Hosting;
74

@@ -11,7 +8,7 @@ namespace CompositionContainerExample
118
[Export]
129
class MyAddin
1310
{
14-
public String myData { get { return "The data!"; } }
11+
public string myData => "The data!";
1512
}
1613

1714
class MyProgram
@@ -22,17 +19,17 @@ class MyProgram
2219

2320
class Program
2421
{
25-
static void Main(string[] args)
22+
static void Main()
2623
{
27-
AggregateCatalog catalog = new AggregateCatalog();
24+
AggregateCatalog catalog = new();
2825
catalog.Catalogs.Add(new AssemblyCatalog(typeof(MyAddin).Assembly));
29-
CompositionContainer _container = new CompositionContainer(catalog);
30-
MyProgram myProgram = new MyProgram();
31-
_container.SatisfyImportsOnce(myProgram);
26+
CompositionContainer container = new(catalog);
27+
MyProgram myProgram = new();
28+
container.SatisfyImportsOnce(myProgram);
3229
Console.WriteLine(myProgram.myAddin.myData);
3330
Console.ReadLine();
3431

35-
_container.Dispose();
32+
container.Dispose();
3633
}
3734
}
3835
//</snippet1>
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.ComponentModel.Composition;
1+
using System.ComponentModel.Composition;
62

73
namespace ClassLibrary1
84
{
95
//<snippet2>
106
[Export]
117
public class Test1
128
{
13-
public String data = "The data!";
9+
public string data { get; } = "The data!";
1410
}
1511
//</snippet2>
1612
}

snippets/csharp/System.ComponentModel.Composition.Hosting/DirectoryCatalog/consoleapplication7/program.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
52
using System.ComponentModel.Composition;
63
using System.ComponentModel.Composition.Hosting;
74
using ClassLibrary1;
@@ -17,11 +14,11 @@ public class Test2
1714

1815
class Program
1916
{
20-
static void Main(string[] args)
17+
static void Main()
2118
{
22-
DirectoryCatalog catalog = new DirectoryCatalog(".");
23-
CompositionContainer container = new CompositionContainer(catalog);
24-
Test2 test = new Test2();
19+
DirectoryCatalog catalog = new(".");
20+
CompositionContainer container = new(catalog);
21+
Test2 test = new();
2522
container.SatisfyImportsOnce(test);
2623
Console.WriteLine(test.data.data);
2724
Console.ReadLine();

snippets/csharp/System.ComponentModel.Composition/ExportAttribute/program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace ConsoleApplication3
1010
[Export]
1111
public class MyExport1
1212
{
13-
public string data = "Test Data 1.";
13+
public string data { get; } = "Test Data 1.";
1414
}
1515

1616
public class MyImporter1
@@ -28,7 +28,7 @@ public interface MyInterface
2828
[Export(typeof(MyInterface))]
2929
public class MyExport2 : MyInterface
3030
{
31-
public string data = "Test Data 2.";
31+
public string data { get; } = "Test Data 2.";
3232
}
3333

3434
public class MyImporter2
@@ -43,7 +43,7 @@ public class MyImporter2
4343
[Export("MyContractName", typeof(MyInterface))]
4444
public class MyExport3 : MyInterface
4545
{
46-
public string data = "Test Data 3.";
46+
public string data { get; } = "Test Data 3.";
4747
}
4848

4949
public class MyImporter3

snippets/csharp/System.ComponentModel.Design.Serialization/CodeDomSerializer/Overview/idesignerserializationmanagersample.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ internal class MyCodeDomSerializer : CodeDomSerializer
1111
public override object Deserialize(IDesignerSerializationManager manager, object codeObject)
1212
{
1313
// Associate the component with the serializer.
14-
CodeDomSerializer baseClassSerializer = (CodeDomSerializer)manager.
15-
GetSerializer(typeof(MyComponent).BaseType, typeof(CodeDomSerializer));
14+
CodeDomSerializer baseClassSerializer = (CodeDomSerializer)manager.GetSerializer(
15+
typeof(MyComponent).BaseType, typeof(CodeDomSerializer));
1616

1717
/* This is the simplest case, in which the class just calls the base class
1818
to do the work. */
@@ -22,9 +22,9 @@ public override object Deserialize(IDesignerSerializationManager manager, object
2222
public override object Serialize(IDesignerSerializationManager manager, object value)
2323
{
2424
/* Associate the component with the serializer in the same manner as with
25-
Deserialize */
26-
CodeDomSerializer baseClassSerializer = (CodeDomSerializer)manager.
27-
GetSerializer(typeof(MyComponent).BaseType, typeof(CodeDomSerializer));
25+
Deserialize. */
26+
CodeDomSerializer baseClassSerializer = (CodeDomSerializer)manager.GetSerializer(
27+
typeof(MyComponent).BaseType, typeof(CodeDomSerializer));
2828

2929
object codeObject = baseClassSerializer.Serialize(manager, value);
3030

snippets/csharp/System.ComponentModel.Design.Serialization/CodeDomSerializerException/Overview/source.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
22
using System.CodeDom;
3-
using System.ComponentModel;
4-
using System.ComponentModel.Design;
53
using System.ComponentModel.Design.Serialization;
64

75
namespace CodeDomSerializerExceptionExample
@@ -12,7 +10,7 @@ class CodeDomSerializerExceptionExample
1210
static void Main(string[] args)
1311
{
1412
//<Snippet1>
15-
throw new CodeDomSerializerException("This exception was raised as an example.", new CodeLinePragma("Example.txt", 20));
13+
throw new CodeDomSerializerException("This exception was raised as an example.", new CodeLinePragma("Example.txt", 20));
1614
//</Snippet1>
1715
}
1816
}

snippets/csharp/System.ComponentModel.Design.Serialization/ContextStack/Overview/class1.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
//<Snippet1>
22
using System;
3-
using System.ComponentModel;
4-
using System.ComponentModel.Design;
53
using System.ComponentModel.Design.Serialization;
6-
using System.Windows.Forms;
74

85
namespace ContextStackExample
96
{
@@ -16,21 +13,23 @@ static void Main(string[] args)
1613
// Create a ContextStack.
1714
ContextStack stack = new ContextStack();
1815
//</Snippet2>
19-
16+
2017
//<Snippet3>
2118
// Push ten items on to the stack and output the value of each.
22-
for( int number = 0; number < 10; number ++ )
19+
for (int number = 0; number < 10; number++)
2320
{
24-
Console.WriteLine( "Value pushed to stack: "+number.ToString() );
25-
stack.Push( number );
21+
Console.WriteLine($"Value pushed to stack: {number}");
22+
stack.Push(number);
2623
}
2724
//</Snippet3>
2825

2926
//<Snippet4>
3027
// Pop each item off the stack.
3128
object item = null;
32-
while( (item = stack.Pop()) != null )
33-
Console.WriteLine( "Value popped from stack: "+item.ToString() );
29+
while ((item = stack.Pop()) != null)
30+
{
31+
Console.WriteLine($"Value popped from stack: {item}");
32+
}
3433
//</Snippet4>
3534
}
3635
}

0 commit comments

Comments
 (0)