@@ -13,6 +13,7 @@ internal class ActivationDataActivatorProvider : IGrainContextActivatorProvider
13
13
private readonly IServiceProvider _serviceProvider ;
14
14
private readonly IActivationWorkingSet _activationWorkingSet ;
15
15
private readonly ILogger < WorkItemGroup > _workItemGroupLogger ;
16
+ private readonly ILogger < Grain > _grainLogger ;
16
17
private readonly ILogger < ActivationTaskScheduler > _activationTaskSchedulerLogger ;
17
18
private readonly IOptions < SchedulingOptions > _schedulingOptions ;
18
19
private readonly GrainTypeSharedContextResolver _sharedComponentsResolver ;
@@ -27,12 +28,14 @@ public ActivationDataActivatorProvider(
27
28
GrainReferenceActivator grainReferenceActivator ,
28
29
GrainTypeSharedContextResolver sharedComponentsResolver ,
29
30
IActivationWorkingSet activationWorkingSet ,
31
+ ILogger < Grain > grainLogger ,
30
32
ILogger < WorkItemGroup > workItemGroupLogger ,
31
33
ILogger < ActivationTaskScheduler > activationTaskSchedulerLogger ,
32
34
IOptions < SchedulingOptions > schedulingOptions )
33
35
{
34
36
_activationWorkingSet = activationWorkingSet ;
35
37
_workItemGroupLogger = workItemGroupLogger ;
38
+ _grainLogger = grainLogger ;
36
39
_activationTaskSchedulerLogger = activationTaskSchedulerLogger ;
37
40
_schedulingOptions = schedulingOptions ;
38
41
_sharedComponentsResolver = sharedComponentsResolver ;
@@ -61,6 +64,7 @@ public bool TryGet(GrainType grainType, out IGrainContextActivator activator)
61
64
instanceActivator ,
62
65
_serviceProvider ,
63
66
sharedContext ,
67
+ _grainLogger ,
64
68
_workItemGroupLogger ,
65
69
_activationTaskSchedulerLogger ,
66
70
_schedulingOptions ) ;
@@ -85,12 +89,14 @@ private class ActivationDataActivator : IGrainContextActivator
85
89
private readonly IGrainActivator _grainActivator ;
86
90
private readonly IServiceProvider _serviceProvider ;
87
91
private readonly GrainTypeSharedContext _sharedComponents ;
92
+ private readonly ILogger < Grain > _grainLogger ;
88
93
private readonly Func < IGrainContext , WorkItemGroup > _createWorkItemGroup ;
89
94
90
95
public ActivationDataActivator (
91
96
IGrainActivator grainActivator ,
92
97
IServiceProvider serviceProvider ,
93
98
GrainTypeSharedContext sharedComponents ,
99
+ ILogger < Grain > grainLogger ,
94
100
ILogger < WorkItemGroup > workItemGroupLogger ,
95
101
ILogger < ActivationTaskScheduler > activationTaskSchedulerLogger ,
96
102
IOptions < SchedulingOptions > schedulingOptions )
@@ -101,6 +107,7 @@ public ActivationDataActivator(
101
107
_grainActivator = grainActivator ;
102
108
_serviceProvider = serviceProvider ;
103
109
_sharedComponents = sharedComponents ;
110
+ _grainLogger = grainLogger ;
104
111
_createWorkItemGroup = context => new WorkItemGroup (
105
112
context ,
106
113
_workItemGroupLogger ,
@@ -124,6 +131,10 @@ public IGrainContext CreateContext(GrainAddress activationAddress)
124
131
var instance = _grainActivator . CreateInstance ( context ) ;
125
132
context . SetGrainInstance ( instance ) ;
126
133
}
134
+ catch ( Exception exception )
135
+ {
136
+ _grainLogger . LogError ( exception , "Failed to construct grain '{GrainId}'." , activationAddress . GrainId ) ;
137
+ }
127
138
finally
128
139
{
129
140
RuntimeContext . ResetExecutionContext ( originalContext ) ;
0 commit comments