Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono] Hot Reload: support for reloadable types #66749

Merged
merged 37 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
702faa1
Checkpoint. Infrastructure for added types
lambdageek Mar 9, 2022
6dc3e90
extra tracing
lambdageek Mar 10, 2022
6c08cfc
register member->parent lookups for newly-added classes and members
lambdageek Mar 10, 2022
e2c5f43
fix off by one error creating class from skeleton
lambdageek Mar 10, 2022
5c870a0
Revert "extra tracing"
lambdageek Mar 10, 2022
8d80630
AddNestedClass test works with mono now; also make it generic
lambdageek Mar 10, 2022
d9fd856
checkpoint: adding properties
lambdageek Mar 10, 2022
d133363
Add a property to AddNestedClass test
lambdageek Mar 11, 2022
3a7f6f5
remove allow class/field/method/property ifdefs
lambdageek Mar 11, 2022
9131764
add event to AddNestedClass
lambdageek Mar 11, 2022
37481f2
add DISALLOW_BROKEN_PARENT ifdef
lambdageek Mar 11, 2022
b5fe053
checkpoint: adding events
lambdageek Mar 11, 2022
f0528b8
Add new test ReflectionAddNewType
lambdageek Mar 14, 2022
5829e72
Add new types to the image name cache
lambdageek Mar 14, 2022
b1e3c04
Assembly.GetTypes and additional tests
lambdageek Mar 14, 2022
615d2a5
Make nested types work
lambdageek Mar 14, 2022
36fbca0
GetInterfaces on new types; also Activator.CreateInstance
lambdageek Mar 14, 2022
68e2eba
Mark mono_class_get_nested_classes_property as a component API
lambdageek Mar 15, 2022
63fb67a
Add GetMethods, GetFields, GetMethod, GetField test
lambdageek Mar 15, 2022
7861d05
[class] Implement added method iteration
lambdageek Mar 15, 2022
7c18fb9
Implement added field iteration
lambdageek Mar 15, 2022
13c32ca
Add a GetField(BindingFlags.Static) test case
lambdageek Mar 15, 2022
d2bcbfc
Add Enum.GetNames and GetProperties tests - not working yet
lambdageek Mar 15, 2022
64c03eb
Mark mono_class_get_method_count as a component API
lambdageek Mar 16, 2022
5153195
Enum values work
lambdageek Mar 16, 2022
e759238
Use GSList for added_fields (and props, events); add from_update bit
lambdageek Mar 16, 2022
ccd590f
Reflection on props in new classes works
lambdageek Mar 16, 2022
4c8e0f1
nit: unused variable
lambdageek Mar 17, 2022
a9d1293
events on new classes work
lambdageek Mar 17, 2022
fa0ec65
Add CustomAttribute reflection test
lambdageek Mar 17, 2022
0b61b58
fix whitespace
lambdageek Mar 17, 2022
6b59577
remove test for props on existing type - it's not part of this PR
lambdageek Mar 17, 2022
a393f3b
instance field additions to existing types aren't supported yet
lambdageek Mar 17, 2022
8d129c1
rm TODO and FIXME
lambdageek Mar 17, 2022
9917ef3
store prop and event from_update bit in attrs
lambdageek Mar 17, 2022
7a4c892
remove instance fields from reflection test
lambdageek Mar 17, 2022
2c56d90
make the Browser EAT lanes happy
lambdageek Mar 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ namespace System.Reflection.Metadata.ApplyUpdate.Test
{
public class AddNestedClass
{
public static Action<string> X; // make the linker happy
public static Delegate Y;
public event Action<string> Evt;
public void R () { Evt ("123"); }
public AddNestedClass()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,46 @@ namespace System.Reflection.Metadata.ApplyUpdate.Test
{
public class AddNestedClass
{
public static Action<string> X; // make the linker happy
public static Delegate Y;
public event Action<string> Evt;
public void R () { Evt ("123"); }
public AddNestedClass()
{
}

public string TestMethod()
{
var n = new Nested();
n.f = "123";
return n.M();
var n = new Nested<string, int>();
n.Eff = "123";
n.g = 456;
n.Evt += new Action<string> (n.DefaultHandler);
n.RaiseEvt();
return n.M() + n.buf;
}

private class Nested {
private class Nested<T, U> {
public Nested() { }
internal string f;
internal T f;
internal U g;
public T Eff {
get => f;
set { f = value; }
}
public string M () {
return f + "456";
return Eff.ToString() + g.ToString();
}

public event Action<string> Evt;

public void RaiseEvt () {
Evt ("789");
}

public string buf;

public void DefaultHandler (string s) {
this.buf = s;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;


namespace System.Reflection.Metadata.ApplyUpdate.Test.ReflectionAddNewType;

public interface IExistingInterface {
public string ItfMethod(int i);
}

public struct QExistingStruct
{
}

public enum FExistingEnum {
One, Two
}

public class ZExistingClass
{
public class PreviousNestedClass {
public static DateTime Now; // make the linker happy
public static ICloneable C;
public event EventHandler<string> E;
public void R() { E(this,"123"); }
}
}

[AttributeUsage(AttributeTargets.All, AllowMultiple=true, Inherited=false)]
public class CustomNoteAttribute : Attribute {
public CustomNoteAttribute(string note) {Note = note;}

public string Note;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;


namespace System.Reflection.Metadata.ApplyUpdate.Test.ReflectionAddNewType;

public interface IExistingInterface {
public string ItfMethod(int i);
}

public struct QExistingStruct
{
}

public enum FExistingEnum {
One, Two
}

public class ZExistingClass
{
public class PreviousNestedClass {
public static DateTime Now; // make the linker happy
public static ICloneable C;
public event EventHandler<string> E;
public void R() { E(this,"123"); }
}
public class NewNestedClass {};


public string NewMethod (string s, int i) => s + i.ToString();

// Mono doesn't support instance fields yet
#if false
public int NewField;
#endif

public static DateTime NewStaticField;

public static double NewProp { get; set; }
}

[AttributeUsage(AttributeTargets.All, AllowMultiple=true, Inherited=false)]
public class CustomNoteAttribute : Attribute {
public CustomNoteAttribute(string note) {Note = note;}

public string Note;
}

[CustomNote("123")]
public class NewToplevelClass : IExistingInterface, ICloneable {
public string ItfMethod(int i) {
return i.ToString();
}

[CustomNote("abcd")]
public void SomeMethod(int x) {}

public virtual object Clone() {
return new NewToplevelClass();
}

public class AlsoNested { }

[CustomNote("hijkl")]
public float NewProp {get; set;}

public byte[] OtherNewProp {get; set;}

public event EventHandler<string> NewEvent;
public event EventHandler<byte> OtherNewEvent;
}

public class NewGenericClass<T> : NewToplevelClass {
public override object Clone() {
return new NewGenericClass<T>();
}
}

public struct NewToplevelStruct {
}

public interface INewInterface : IExistingInterface {
public int AddedItfMethod (string s);
}

public enum NewEnum {
Red, Yellow, Green
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>System.Runtime.Loader.Tests</RootNamespace>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<TestRuntime>true</TestRuntime>
<DeltaScript>deltascript.json</DeltaScript>
</PropertyGroup>
<ItemGroup>
<Compile Include="ReflectionAddNewType.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"changes": [
{"document": "ReflectionAddNewType.cs", "update": "ReflectionAddNewType_v1.cs"},
]
}

Loading