@@ -69,53 +69,6 @@ public readonly struct RunningProjectInfo
69
69
public required bool RestartWhenChangesHaveNoEffect { get ; init ; }
70
70
}
71
71
72
- [ Obsolete ( "Use Updates2" ) ]
73
- public readonly struct Updates (
74
- ModuleUpdateStatus status ,
75
- ImmutableArray < Diagnostic > diagnostics ,
76
- ImmutableArray < Update > projectUpdates ,
77
- IReadOnlySet < Project > projectsToRestart ,
78
- IReadOnlySet < Project > projectsToRebuild )
79
- {
80
- /// <summary>
81
- /// Status of the updates.
82
- /// </summary>
83
- public readonly ModuleUpdateStatus Status { get ; } = status ;
84
-
85
- /// <summary>
86
- /// Hot Reload specific diagnostics to be reported (includes rude edits and emit errors).
87
- /// </summary>
88
- public ImmutableArray < Diagnostic > Diagnostics { get ; } = diagnostics ;
89
-
90
- /// <summary>
91
- /// Updates to be applied to modules. Empty if there are blocking rude edits.
92
- /// Only updates to projects that are not included in <see cref="ProjectsToRebuild"/> are listed.
93
- /// </summary>
94
- public ImmutableArray < Update > ProjectUpdates { get ; } = projectUpdates ;
95
-
96
- /// <summary>
97
- /// Running projects that need to be restarted due to rude edits in order to apply changes.
98
- /// </summary>
99
- [ Obsolete ( "Use ProjectIdsToRestart" ) ]
100
- public IReadOnlySet < Project > ProjectsToRestart { get ; } = projectsToRestart ;
101
-
102
- /// <summary>
103
- /// Projects with changes that need to be rebuilt in order to apply changes.
104
- /// </summary>
105
- [ Obsolete ( "Use ProjectIdsToRebuild" ) ]
106
- public IReadOnlySet < Project > ProjectsToRebuild { get ; } = projectsToRebuild ;
107
-
108
- /// <summary>
109
- /// Running projects that need to be restarted due to rude edits in order to apply changes.
110
- /// </summary>
111
- public ImmutableArray < ProjectId > ProjectIdsToRestart { get ; } = projectsToRestart . SelectAsArray ( p => p . Id ) ;
112
-
113
- /// <summary>
114
- /// Projects with changes that need to be rebuilt in order to apply changes.
115
- /// </summary>
116
- public ImmutableArray < ProjectId > ProjectIdsToRebuild { get ; } = projectsToRebuild . SelectAsArray ( p => p . Id ) ;
117
- }
118
-
119
72
public enum Status
120
73
{
121
74
/// <summary>
@@ -233,48 +186,8 @@ public void CapabilitiesChanged()
233
186
public static string ? GetTargetFramework ( Project project )
234
187
=> project . State . NameAndFlavor . flavor ;
235
188
236
- [ Obsolete ]
237
- public async Task < Updates > GetUpdatesAsync ( Solution solution , IImmutableSet < ProjectId > runningProjects , CancellationToken cancellationToken )
238
- {
239
- var sessionId = GetDebuggingSession ( ) ;
240
-
241
- var runningProjectsImpl = runningProjects . ToImmutableDictionary ( keySelector : p => p , elementSelector : _ => new EditAndContinue . RunningProjectInfo ( )
242
- {
243
- RestartWhenChangesHaveNoEffect = false ,
244
- AllowPartialUpdate = true
245
- } ) ;
246
-
247
- var results = await _encService . EmitSolutionUpdateAsync ( sessionId , solution , runningProjectsImpl , s_solutionActiveStatementSpanProvider , cancellationToken ) . ConfigureAwait ( false ) ;
248
-
249
- // If the changes fail to apply dotnet-watch fails.
250
- // We don't support discarding the changes and letting the user retry.
251
- if ( ! results . ModuleUpdates . Updates . IsEmpty )
252
- {
253
- _encService . CommitSolutionUpdate ( sessionId ) ;
254
- }
255
-
256
- var diagnostics = results . GetAllDiagnostics ( ) ;
257
-
258
- var projectUpdates =
259
- from update in results . ModuleUpdates . Updates
260
- let project = solution . GetRequiredProject ( update . ProjectId )
261
- where ! results . ProjectsToRestart . ContainsKey ( project . Id )
262
- select new Update (
263
- update . Module ,
264
- project . Id ,
265
- update . ILDelta ,
266
- update . MetadataDelta ,
267
- update . PdbDelta ,
268
- update . UpdatedTypes ,
269
- update . RequiredCapabilities ) ;
270
-
271
- return new Updates (
272
- results . ModuleUpdates . Status ,
273
- diagnostics ,
274
- [ .. projectUpdates ] ,
275
- results . ProjectsToRestart . Keys . Select ( solution . GetRequiredProject ) . ToImmutableHashSet ( ) ,
276
- results . ProjectsToRebuild . Select ( solution . GetRequiredProject ) . ToImmutableHashSet ( ) ) ;
277
- }
189
+ // TODO: remove, for backwards compat only
190
+ public static bool RequireCommit { get ; set ; }
278
191
279
192
/// <summary>
280
193
/// Emits updates for all projects that differ between the given <paramref name="solution"/> snapshot and the one given to the previous successful call or
@@ -303,7 +216,7 @@ public async Task<Updates2> GetUpdatesAsync(Solution solution, ImmutableDictiona
303
216
304
217
// If the changes fail to apply dotnet-watch fails.
305
218
// We don't support discarding the changes and letting the user retry.
306
- if ( ! results . ModuleUpdates . Updates . IsEmpty )
219
+ if ( ! RequireCommit && results . ModuleUpdates . Status is ModuleUpdateStatus . Ready or ModuleUpdateStatus . RestartRequired )
307
220
{
308
221
_encService . CommitSolutionUpdate ( sessionId ) ;
309
222
}
@@ -332,6 +245,18 @@ public async Task<Updates2> GetUpdatesAsync(Solution solution, ImmutableDictiona
332
245
} ;
333
246
}
334
247
248
+ public void CommitUpdate ( )
249
+ {
250
+ var sessionId = GetDebuggingSession ( ) ;
251
+ _encService . CommitSolutionUpdate ( sessionId ) ;
252
+ }
253
+
254
+ public void DiscardUpdate ( )
255
+ {
256
+ var sessionId = GetDebuggingSession ( ) ;
257
+ _encService . DiscardSolutionUpdate ( sessionId ) ;
258
+ }
259
+
335
260
public void UpdateBaselines ( Solution solution , ImmutableArray < ProjectId > projectIds )
336
261
{
337
262
var sessionId = GetDebuggingSession ( ) ;
0 commit comments