Skip to content

Commit

Permalink
Change .Result to .GetAwaiter().GetResult() (#3040)
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwille authored Jul 24, 2023
1 parent b482ae9 commit f56881d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ICSharpCode.ILSpyX/LoadedAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public string Text {
if (metadata.IsAssembly)
{
versionOrInfo = metadata.GetAssemblyDefinition().Version?.ToString();
var tfId = GetTargetFrameworkIdAsync().Result;
string tfId = GetTargetFrameworkIdAsync().GetAwaiter().GetResult();
if (!string.IsNullOrEmpty(tfId))
versionOrInfo += ", " + tfId.Replace("Version=", " ");
}
Expand Down Expand Up @@ -638,8 +638,8 @@ internal IAssemblyResolver GetAssemblyResolver(AssemblyListSnapshot snapshot,
private UniversalAssemblyResolver GetUniversalResolver(bool applyWinRTProjections)
{
return LazyInitializer.EnsureInitialized(ref this.universalResolver, () => {
var targetFramework = this.GetTargetFrameworkIdAsync().Result;
var runtimePack = this.GetRuntimePackAsync().Result;
var targetFramework = this.GetTargetFrameworkIdAsync().GetAwaiter().GetResult();
var runtimePack = this.GetRuntimePackAsync().GetAwaiter().GetResult();
var readerOptions = applyWinRTProjections
? MetadataReaderOptions.ApplyWindowsRuntimeProjections
Expand Down
6 changes: 4 additions & 2 deletions ILSpy/TreeNodes/ReferenceFolderTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ protected override void LoadChildren()

public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.WriteCommentLine(output, $"Detected TargetFramework-Id: {parentAssembly.LoadedAssembly.GetTargetFrameworkIdAsync().Result}");
language.WriteCommentLine(output, $"Detected RuntimePack: {parentAssembly.LoadedAssembly.GetRuntimePackAsync().Result}");
string targetFramework = parentAssembly.LoadedAssembly.GetTargetFrameworkIdAsync().GetAwaiter().GetResult();
string runtimePack = parentAssembly.LoadedAssembly.GetRuntimePackAsync().GetAwaiter().GetResult();
language.WriteCommentLine(output, $"Detected TargetFramework-Id: {targetFramework}");
language.WriteCommentLine(output, $"Detected RuntimePack: {runtimePack}");

App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren));
output.WriteLine();
Expand Down

0 comments on commit f56881d

Please sign in to comment.