@@ -22,6 +22,12 @@ internal sealed class SynthesizedHotReloadExceptionSymbol : NamedTypeSymbol
2222 public const string TypeName = "HotReloadException" ;
2323 public const string CodeFieldName = "Code" ;
2424
25+ /// <summary>
26+ /// The Hot Reload agent that's injected into the application needs to intercept creation of a runtime rude edit.
27+ /// It uses reflection to set this action field.
28+ /// </summary>
29+ public const string CreatedActionFieldName = "Created" ;
30+
2531 private readonly NamedTypeSymbol _baseType ;
2632 private readonly NamespaceSymbol _namespace ;
2733
@@ -31,6 +37,7 @@ internal sealed class SynthesizedHotReloadExceptionSymbol : NamedTypeSymbol
3137 public SynthesizedHotReloadExceptionSymbol (
3238 NamespaceSymbol containingNamespace ,
3339 NamedTypeSymbol exceptionType ,
40+ NamedTypeSymbol actionOfTType ,
3441 TypeSymbol stringType ,
3542 TypeSymbol intType )
3643 {
@@ -40,7 +47,8 @@ public SynthesizedHotReloadExceptionSymbol(
4047 _members =
4148 [
4249 new SynthesizedHotReloadExceptionConstructorSymbol ( this , stringType , intType ) ,
43- new SynthesizedFieldSymbol ( this , intType , CodeFieldName , isPublic : true , isReadOnly : true , isStatic : false )
50+ new SynthesizedFieldSymbol ( this , intType , CodeFieldName , isPublic : true , isReadOnly : true , isStatic : false ) ,
51+ new SynthesizedFieldSymbol ( this , actionOfTType . Construct ( exceptionType ) , CreatedActionFieldName , isPublic : false , isReadOnly : false , isStatic : true )
4452 ] ;
4553 }
4654
@@ -50,6 +58,9 @@ public MethodSymbol Constructor
5058 public FieldSymbol CodeField
5159 => ( FieldSymbol ) _members [ 1 ] ;
5260
61+ public FieldSymbol CreatedActionField
62+ => ( FieldSymbol ) _members [ 2 ] ;
63+
5364 public override ImmutableArray < Symbol > GetMembers ( )
5465 => _members ;
5566
@@ -58,14 +69,15 @@ public override ImmutableArray<Symbol> GetMembers(string name)
5869 {
5970 WellKnownMemberNames . InstanceConstructorName => [ Constructor ] ,
6071 CodeFieldName => [ CodeField ] ,
72+ CreatedActionFieldName => [ CreatedActionField ] ,
6173 _ => [ ]
6274 } ;
6375
6476 public override IEnumerable < string > MemberNames
6577 => _members . Select ( static m => m . Name ) ;
6678
6779 internal override IEnumerable < FieldSymbol > GetFieldsToEmit ( )
68- => [ CodeField ] ;
80+ => [ CodeField , CreatedActionField ] ;
6981
7082 public override ImmutableArray < NamedTypeSymbol > GetTypeMembers ( ) => [ ] ;
7183 public override ImmutableArray < NamedTypeSymbol > GetTypeMembers ( ReadOnlyMemory < char > name ) => [ ] ;
0 commit comments