Skip to content

Commit 4abd0dc

Browse files
committed
fix InvokeAsync violations
1 parent 854cb51 commit 4abd0dc

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/SharpIDE.Godot/Features/Nuget/NugetPackageDetails.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public override void _Ready()
3232
_versionOptionButton = GetNode<OptionButton>("%VersionOptionButton");
3333
_nugetSourceOptionButton = GetNode<OptionButton>("%NugetSourceOptionButton");
3434
_projectsVBoxContainer = GetNode<VBoxContainer>("%ProjectsVBoxContainer");
35-
_nugetSourceOptionButton.ItemSelected += OnNugetSourceSelected;
35+
_nugetSourceOptionButton.ItemSelected += index => _ = Task.GodotRun(() => OnNugetSourceSelected(index));
3636
_versionOptionButton.ItemSelected += VersionSelected;
3737

3838
_projectsVBoxContainer.QueueFreeChildren();
@@ -71,8 +71,8 @@ await this.InvokeAsync(() =>
7171
_nugetSourceOptionButton.AddItem(packageFromSource.Source.Name);
7272
}
7373
_nugetSourceOptionButton.Selected = 0;
74-
OnNugetSourceSelected(0);
7574
});
75+
await OnNugetSourceSelected(0);
7676
}
7777

7878
public async Task SetProjects(HashSet<SharpIdeProjectModel> projects)
@@ -112,7 +112,7 @@ await this.InvokeAsync(() =>
112112
});
113113
}
114114

115-
private async void OnNugetSourceSelected(long sourceIndex)
115+
private async Task OnNugetSourceSelected(long sourceIndex)
116116
{
117117
var packageFromSource = _package!.PackageFromSources[(int)sourceIndex];
118118
var results = await _nugetClientService.GetAllVersionsOfPackageInSource(packageFromSource.PackageSearchMetadata.Identity.Id, packageFromSource.Source);

src/SharpIDE.Godot/Features/Nuget/NugetPanel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,17 @@ private async Task PopulateSearchResults()
137137
return;
138138
using var _ = SharpIdeOtel.Source.StartActivity($"{nameof(NugetPanel)}.{nameof(PopulateSearchResults)}");
139139
var result = await _nugetClientService.GetTop100Results(_solution!.DirectoryPath);
140-
var scenes = result.Select(s =>
140+
using var scenes = result.AsValueEnumerable().Select(s =>
141141
{
142142
var scene = _packageEntryScene.Instantiate<PackageEntry>();
143143
scene.PackageResult = s;
144144
scene.PackageSelected += OnPackageSelected;
145145
return scene;
146-
}).ToList();
146+
}).ToArrayPool();
147147
await this.InvokeAsync(() =>
148148
{
149149
_availablePackagesItemList.QueueFreeChildren();
150-
foreach (var scene in scenes)
150+
foreach (var scene in scenes.Span)
151151
{
152152
_availablePackagesItemList.AddChild(scene);
153153
}

src/SharpIDE.Godot/Features/Nuget/PackageEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public override void _Ready()
4444
_packageIconTextureRect = GetNode<TextureRect>("%PackageIconTextureRect");
4545
_latestVersionLabel.Text = string.Empty;
4646
ApplyValues();
47-
_button.Pressed += async () => await PackageSelected.Invoke(PackageResult);
47+
_button.Pressed += () => _ = Task.GodotRun(() => PackageSelected.Invoke(PackageResult));
4848
}
4949

5050
private void ApplyValues()

0 commit comments

Comments
 (0)