-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c19c251
commit f713475
Showing
4 changed files
with
26 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace InlineIL.Tests.Common; | ||
|
||
public class TypeFromReferencedAssembly | ||
{ | ||
public readonly StructFromReferencedAssembly FieldWithTypeFromThisAssembly = default; | ||
} | ||
|
||
public struct StructFromReferencedAssembly; |
15 changes: 10 additions & 5 deletions
15
src/InlineIL.Tests.UnverifiableAssemblyToProcess/FieldRefTestCases.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
using Microsoft.Diagnostics.Tracing; | ||
using System.Diagnostics.CodeAnalysis; | ||
using InlineIL.Tests.Common; | ||
using static InlineIL.IL.Emit; | ||
|
||
namespace InlineIL.Tests.UnverifiableAssemblyToProcess; | ||
|
||
[SuppressMessage("ReSharper", "UnusedType.Global")] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global")] | ||
[SuppressMessage("ReSharper", "UnassignedField.Global")] | ||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] | ||
public class FieldRefTestCases | ||
{ | ||
public static nint ReadEventRecord(TraceEvent traceEvent) | ||
public void ReadFieldFromReferencedAssemblyType() | ||
{ | ||
// Repro of issue #33 | ||
|
||
IL.Push(traceEvent); | ||
Ldfld(FieldRef.Field(typeof(TraceEvent), "eventRecord")); | ||
return IL.Return<nint>(); | ||
IL.Push(new TypeFromReferencedAssembly()); | ||
Ldfld(FieldRef.Field(typeof(TypeFromReferencedAssembly), nameof(TypeFromReferencedAssembly.FieldWithTypeFromThisAssembly))); | ||
Pop(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters