Make character UI retries transactional
This commit is contained in:
parent
aeac874dab
commit
1dd5706e15
6 changed files with 352 additions and 42 deletions
|
|
@ -53,23 +53,42 @@ internal sealed class CharacterManagementUiMountCoordinator : IDisposable
|
|||
if (resources is null)
|
||||
return;
|
||||
|
||||
Controller = CharacterManagementUiController.Bind(
|
||||
CharacterManagementUiController? candidate =
|
||||
CharacterManagementUiController.CreateDetached(
|
||||
_host,
|
||||
resources.Layout,
|
||||
resources.TemplateResolver,
|
||||
dialogs,
|
||||
_bindings,
|
||||
resources.Strings);
|
||||
if (Controller is not null)
|
||||
{
|
||||
Console.WriteLine(
|
||||
$"[UI] retail character management from enum table 5 "
|
||||
+ $"(0x10000005 -> 0x{resources.LayoutId:X8}, "
|
||||
+ "root 0x1000039A; flat list, no viewport).");
|
||||
}
|
||||
if (candidate is null)
|
||||
return;
|
||||
|
||||
// Take ownership before the first attach/tick. Template resolution
|
||||
// happens inside that tick and can throw after the root and button
|
||||
// handlers are live; the catch below can therefore always retire
|
||||
// the exact partial controller before a later retry.
|
||||
Controller = candidate;
|
||||
candidate.AttachAndTick();
|
||||
Console.WriteLine(
|
||||
$"[UI] retail character management from enum table 5 "
|
||||
+ $"(0x10000005 -> 0x{resources.LayoutId:X8}, "
|
||||
+ "root 0x1000039A; flat list, no viewport).");
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
CharacterManagementUiController? partial = Controller;
|
||||
Controller = null;
|
||||
try
|
||||
{
|
||||
partial?.Dispose();
|
||||
}
|
||||
catch (Exception cleanupError)
|
||||
{
|
||||
Console.WriteLine(
|
||||
"[UI] character management partial-mount cleanup failed: "
|
||||
+ cleanupError.Message);
|
||||
}
|
||||
Console.WriteLine(
|
||||
"[UI] character management mount will retry after resource "
|
||||
+ $"recovery: {error.Message}");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue