Skip to content

Commit 8de8e4c

Browse files
authored
Merge pull request #730 from Washi1337/development
6.0.0-rc.1
2 parents 403ed68 + f8e62d7 commit 8de8e4c

122 files changed

Lines changed: 1531 additions & 1040 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.

.github/workflows/test-and-publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: ubuntu-24.04
3131
steps:
3232
- name: Upload event file
33-
uses: actions/upload-artifact@v6
33+
uses: actions/upload-artifact@v7
3434
with:
3535
name: test-event-file
3636
path: ${{ github.event_path }}
@@ -107,7 +107,7 @@ jobs:
107107
--property:CheckEolTargetFramework=false
108108
109109
- name: Upload Build Artifacts
110-
uses: actions/upload-artifact@v6
110+
uses: actions/upload-artifact@v7
111111
with:
112112
name: build-artifacts
113113
path: artifacts/
@@ -187,7 +187,7 @@ jobs:
187187

188188

189189
- name: Download Build Artifacts
190-
uses: actions/download-artifact@v7
190+
uses: actions/download-artifact@v8
191191
with:
192192
name: build-artifacts
193193
path: artifacts/
@@ -220,7 +220,7 @@ jobs:
220220
221221
# Collect all trx files and upload them.
222222
- name: Upload Test Results
223-
uses: actions/upload-artifact@v6
223+
uses: actions/upload-artifact@v7
224224
if: always()
225225
with:
226226
name: test-results-${{matrix.runner.image}}-${{matrix.runner.arch}}
@@ -245,7 +245,7 @@ jobs:
245245
dotnet-version: 10.0.x
246246

247247
- name: Download Build Artifacts
248-
uses: actions/download-artifact@v7
248+
uses: actions/download-artifact@v8
249249
with:
250250
name: build-artifacts
251251
path: artifacts/

.github/workflows/test-results-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ jobs:
2525
- uses: actions/checkout@v6
2626

2727
- name: Download Event File
28-
uses: actions/download-artifact@v7
28+
uses: actions/download-artifact@v8
2929
with:
3030
run-id: ${{ github.event.workflow_run.id }}
3131
github-token: ${{ github.token }}
3232
name: test-event-file
3333
merge-multiple: false
3434

3535
- name: Download Test Results
36-
uses: actions/download-artifact@v7
36+
uses: actions/download-artifact@v8
3737
with:
3838
run-id: ${{ github.event.workflow_run.id }}
3939
github-token: ${{ github.token }}

Directory.Build.props

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
1010
<LangVersion>14</LangVersion>
1111
<VersionPrefix>6.0.0</VersionPrefix>
12-
<VersionSuffix>beta.6</VersionSuffix>
12+
<VersionSuffix>rc.1</VersionSuffix>
1313
<Deterministic>true</Deterministic>
1414
<UseArtifactsOutput>true</UseArtifactsOutput>
1515
<CheckEolTargetFramework>false</CheckEolTargetFramework>
16+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
17+
<Nullable>enable</Nullable>
1618
</PropertyGroup>
1719

1820
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">

docs/api/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
href: win32resources/toc.yml
99
- name: AsmResolver.DotNet.dll
1010
href: dotnet/toc.yml
11+
- name: AsmResolver.DotNet.Dynamic.dll
12+
href: dotnet-dynamic/toc.yml
1113
- name: AsmResolver.Symbols.Pdb.dll
12-
href: symbols/toc.yml
14+
href: symbols/toc.yml

docs/guides/dotnet/dynamic-methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ contextModule.GetOrCreateModuleType().Methods.Add(definition);
6767
contextModule.Write("Program.patched.dll");
6868
```
6969

70-
See [Obtaining methods and fields](metadata-definitions.md#obtaining-methods-and-fields)
70+
See [Metadata Definitions - Methods](metadata-definitions.md#methods)
7171
and [CIL Method Bodies](managed-method-bodies.md) for more
7272
information on how to use `MethodDefinition` objects.

docs/guides/dotnet/managed-method-bodies.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ Below an example on how emit a call to `Console::WriteLine(string)`:
229229
``` csharp
230230
var writeLine = targetModule.CorLibTypeFactory.CorLibScope
231231
.CreateTypeReference("System", "Console")
232-
.CreateMemberReference("WriteLine", MethodSignature.CreateStatic(targetModule.CorLibTypeFactory.Void, targetModule.CorLibTypeFactory.String));
232+
.CreateMemberReference("WriteLine", MethodSignature.CreateStatic(
233+
returnType: targetModule.CorLibTypeFactory.Void,
234+
parameterTypes: [targetModule.CorLibTypeFactory.String]
235+
));
233236

234237
body.Instructions.Add(CilOpCodes.Ldstr, "Hello, world!");
235238
body.Instructions.Add(CilOpCodes.Call, writeLine);

docs/guides/dotnet/metadata-definitions.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ var newType = new TypeDefinition(
9494
"Namespace",
9595
"Name",
9696
TypeAttributes.Public,
97-
module.CorLibTypeFactory.Object);
97+
module.CorLibTypeFactory.Object
98+
);
9899
```
99100

100101
> [!WARNING]
@@ -109,8 +110,7 @@ var newType = new TypeDefinition(
109110
"Namespace",
110111
"Name",
111112
TypeAttributes.Public,
112-
module.CorLibTypeFactory.CorLibScope
113-
.CreateTypeReference("System", "ValueType")
113+
module.CorLibTypeFactory.CorLibScope.CreateTypeReference("System", "ValueType")
114114
);
115115
```
116116

@@ -122,7 +122,8 @@ ModuleDefinition module = ...
122122
var newType = new TypeDefinition(
123123
"Namespace",
124124
"IName",
125-
TypeAttributes.Public | TypeAttributes.Interface);
125+
TypeAttributes.Public | TypeAttributes.Interface
126+
);
126127
```
127128

128129
Once a type has been constructed, it can be added to either a `ModuleDefinition`
@@ -193,7 +194,8 @@ ModuleDefinition module = ...;
193194
var field = new FieldDefinition(
194195
"MyField",
195196
FieldAttributes.Public,
196-
module.CorLibTypeFactory.Int32);"
197+
module.CorLibTypeFactory.Int32
198+
);"
197199
```
198200

199201
Fields can be added to a type:
@@ -294,10 +296,10 @@ var method = new MethodDefinition(
294296
"MyMethod",
295297
MethodAttributes.Public | MethodAttributes.Static,
296298
MethodSignature.CreateStatic(
297-
module.CorLibTypeFactory.Void, // Return type
298-
module.CorLibTypeFactory.Int32, // Parameter 1
299-
module.CorLibTypeFactory.String // Parameter 2
300-
));
299+
returnType: module.CorLibTypeFactory.Void,
300+
parameterTypes: [module.CorLibTypeFactory.Int32, module.CorLibTypeFactory.String]
301+
)
302+
);
301303
```
302304

303305
Similarly, for instance methods, use the `MethodSignature.CreateInstance` to create the signature:
@@ -308,10 +310,10 @@ var method = new MethodDefinition(
308310
"MyMethod",
309311
MethodAttributes.Public,
310312
MethodSignature.CreateInstance(
311-
module.CorLibTypeFactory.Void, // Return type
312-
module.CorLibTypeFactory.Int32, // Parameter 1
313-
module.CorLibTypeFactory.String // Parameter 2
314-
));
313+
returnType: module.CorLibTypeFactory.Void,
314+
parameterTypes: [module.CorLibTypeFactory.Int32, module.CorLibTypeFactory.String]
315+
)
316+
);
315317
```
316318

317319
See also [Metadata Signatures](metadata-signatures.md) for more information on type and method signatures.

docs/guides/dotnet/metadata-references.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ Below is an example of how to create a fully imported reference to `void System.
8282
var method = factory.CorLibScope
8383
.CreateTypeReference("System", "Console")
8484
.CreateMemberReference("WriteLine", MethodSignature.CreateStatic(
85-
factory.Void, factory.String));
85+
returnType: factory.Void,
86+
parameterTypes: [factory.String]
87+
));
8688

8789
// importedMethod now references "void System.Console.WriteLine(string)"
8890
```
@@ -93,7 +95,7 @@ var method = factory.CorLibScope
9395
> ```csharp
9496
> var method = factory.CorLibScope
9597
> .CreateTypeReference("System", "Console")
96-
> .CreateMemberReference("WriteLine", MethodSignature.CreateStatic(factory.Void, factory.String))
98+
> .CreateMemberReference("WriteLine", MethodSignature.CreateStatic(factory.Void, [factory.String]))
9799
> .ImportWith(module.DefaultImporter); // Explicitly import the reference.
98100
> ```
99101
@@ -108,8 +110,9 @@ var importedMethod = factory.CorLibScope
108110
.MakeGenericInstanceType(factory.Int32)
109111
.ToTypeDefOrRef()
110112
.CreateMemberReference("Add", MethodSignature.CreateInstance(
111-
factory.Void,
112-
new GenericParameterSignature(GenericParameterType.Type, 0)));
113+
returnType: factory.Void,
114+
parameterTypes: [new GenericParameterSignature(GenericParameterType.Type, 0)]
115+
));
113116
114117
// importedMethod now references "System.Collections.Generic.List`1<System.Int32>.Add(!0)"
115118
```
@@ -123,7 +126,9 @@ var factory = module.CorLibTypeFactory;
123126
var importedMethod = factory.CorLibScope
124127
.CreateTypeReference("System", "Array")
125128
.CreateMemberReference("Empty", MethodSignature.CreateStatic(
126-
new GenericParameterSignature(GenericParameterType.Method, 0).MakeSzArrayType(), 1))
129+
returnType: new GenericParameterSignature(GenericParameterType.Method, 0).MakeSzArrayType(),
130+
genericParameterCount: 1,
131+
parameterTypes: []))
127132
.MakeGenericInstanceMethod(factory.String);
128133

129134
// importedMethod now references "!0[] System.Array.Empty<System.String>()"

docs/guides/dotnet/metadata-signatures.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ This can also be created by manually instantiating a `GenericInstanceTypeSignatu
123123
``` csharp
124124
var listTypeRef = new TypeReference(corlibScope, "System.Collections.Generic", "List`1");
125125

126-
var listOfString = new GenericInstanceTypeSignature(listTypeRef,
126+
var listOfString = new GenericInstanceTypeSignature(
127+
listTypeRef,
127128
isValueType: false,
128129
typeArguments: [module.CorLibTypeFactory.String]
129130
);
@@ -140,9 +141,9 @@ In AsmResolver, they are represented by wrapping a `MethodSignature` into a `Fun
140141
``` csharp
141142
var factory = module.CorLibTypeFactory;
142143
var type = MethodSignature.CreateStatic(
143-
factory.Void,
144-
factory.Int32, factory.Int32)
145-
.MakeFunctionPointerType();
144+
returnType: factory.Void,
145+
parameterTypes: [factory.Int32, factory.Int32]
146+
).MakeFunctionPointerType();
146147

147148
// type now contains a reference to `method void *(int32, int32)`.
148149
```
@@ -152,8 +153,8 @@ Alternatively, a `FunctionPointerTypeSignature` can be created manually as well:
152153
``` csharp
153154
var factory = module.CorLibTypeFactory;
154155
var signature = MethodSignature.CreateStatic(
155-
factory.Void,
156-
factory.Int32, factory.Int32
156+
returnType: factory.Void,
157+
parameterTypes: [factory.Int32, factory.Int32]
157158
);
158159

159160
var type = new FunctionPointerTypeSignature(signature);
@@ -323,7 +324,10 @@ Method signatures can be created using the factory methods `MethodSiganture.Crea
323324
var method = new MethodDefinition(
324325
name: "Foo",
325326
attributes: MethodAttributes.Static,
326-
signature: MethodSignature.CreateStatic(module.CorLibTypeFactory.Void, module.CorLibTypeFactory.Int32)
327+
signature: MethodSignature.CreateStatic(
328+
returnType: module.CorLibTypeFactory.Void,
329+
parameterTypes: [module.CorLibTypeFactory.Int32]
330+
)
327331
);
328332
```
329333

docs/guides/dotnet/runtime-contexts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ You can also explicitly create a new (empty) runtime context, targeting a specif
2323
var context = new RuntimeContext(DotNetRuntimeInfo.NetCoreApp(3, 1));
2424
```
2525
```csharp
26+
// Create based on the original target runtime of an existing assembly.
27+
var assembly = AssemblyDefinition.FromFile(@"C:\Path\To\File.exe", createRuntimeContext: false);
28+
var context = new RuntimeContext(assembly.ManifestModule.OriginalTargetRuntime);
29+
```
30+
```csharp
2631
// Create based on the contents of a runtime config JSON file.
2732
var config = RuntimeConfiguration.FromFile(@"C:\Path\To\File.runtimeconfig.json");
2833
var context = new RuntimeContext(config);
@@ -43,6 +48,7 @@ BundleManifest bundle = ...
4348
var context = new RuntimeContext(bundle);
4449
```
4550

51+
4652
A `RuntimeContext` can also be configured with a custom assembly resolver (e.g., for cases where assemblies are embedded in a module or located at unconventional file paths):
4753
```csharp
4854
class MyAssemblyResolver : IAssemblyResolver

0 commit comments

Comments
 (0)