Skip to content

Commit 1cc6d79

Browse files
committed
Add support for C# overriden operators
Fix crossgen2 with net8.0 Fix default args for NativeAOT Fix "click for releasenotes" link
1 parent 38e26cd commit 1cc6d79

13 files changed

+48
-44
lines changed

Disasmo/Disasmo.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<EmbeddedResource Include="Resources\DisasmoLoader3.csproj_template" />
10-
<EmbeddedResource Include="Resources\DisasmoLoader3.cs_template" />
9+
<EmbeddedResource Include="Resources\DisasmoLoader4.csproj_template" />
10+
<EmbeddedResource Include="Resources\DisasmoLoader4.cs_template" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

Disasmo/Resources/DisasmoLoader3.cs_template renamed to Disasmo/Resources/DisasmoLoader4.cs_template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using System.Runtime.CompilerServices;
66
using System.Runtime.Loader;
77

88
// A small console app to load a specific assembly via ALC and precompile specified methods
9-
// "DisasmoLoader3 MyDll.dll MyType MyMethod False"
9+
// "DisasmoLoader4 MyDll.dll MyType MyMethod False"
1010

1111
public class DisasmoLoader
1212
{

Disasmo/Resources/DisasmoLoader3.csproj_template renamed to Disasmo/Resources/DisasmoLoader4.csproj_template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
77
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
88
<OutputPath>out</OutputPath>
9-
<AssemblyName>DisasmoLoader3</AssemblyName>
9+
<AssemblyName>DisasmoLoader4</AssemblyName>
1010
</PropertyGroup>
1111
</Project>

Disasmo/Utils/LoaderAppManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ namespace Disasmo.Utils
1010
// Rebuilds it when the Add-in updates or SDK's version changes.
1111
public static class LoaderAppManager
1212
{
13-
public const string DisasmoLoaderName = "DisasmoLoader3";
13+
public static readonly string DisasmoLoaderName = "DisasmoLoader4";
1414

1515
private static async Task<string> GetPathToLoader(string tf, Version addinVersion, CancellationToken ct)
1616
{
1717
ProcessResult dotnetVersion = await ProcessUtils.RunProcess("dotnet", "--version", cancellationToken: ct);
18+
UserLogger.AppendText($"dotnet --version: {dotnetVersion.Output} ({dotnetVersion.Error})");
1819
return Path.Combine(Path.GetTempPath(), DisasmoLoaderName, $"{addinVersion}_{tf}_{dotnetVersion.Output}");
1920
}
2021

src/Vsix/Analyzers/DisasmMethodOrClassAction.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88

99
namespace Disasmo
1010
{
11-
1211
internal class DisasmMethodOrClassAction : BaseSuggestedAction
1312
{
14-
1513
public DisasmMethodOrClassAction(CommonSuggestedActionsSource actionsSource) : base(actionsSource) {}
1614

1715
public override async void Invoke(CancellationToken cancellationToken)
@@ -27,7 +25,8 @@ public override async void Invoke(CancellationToken cancellationToken)
2725
}
2826
}
2927
}
30-
catch {
28+
catch
29+
{
3130
}
3231
}
3332

@@ -56,6 +55,8 @@ protected override async Task<bool> IsValidSymbol(Document document, int tokenPo
5655
return true;
5756
if (token.Parent is PropertyDeclarationSyntax)
5857
return true;
58+
if (token.Parent is OperatorDeclarationSyntax)
59+
return true;
5960
}
6061
catch
6162
{
@@ -75,6 +76,9 @@ static ISymbol FindRelatedSymbol(SemanticModel semanticModel, SyntaxNode node, b
7576
if (node is PropertyDeclarationSyntax p)
7677
return semanticModel.GetDeclaredSymbol(p, ct);
7778

79+
if (node is OperatorDeclarationSyntax o)
80+
return semanticModel.GetDeclaredSymbol(o, ct);
81+
7882
if (node is ConstructorDeclarationSyntax ctor)
7983
return semanticModel.GetDeclaredSymbol(ctor, ct);
8084

src/Vsix/DisasmoPackage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public static async Task<Version> GetLatestVersionOnline()
7474
try
7575
{
7676
await Task.Delay(3000);
77+
return new Version(5, 5, 2);
7778
// is there an API to do it? I don't care - let's parse html :D
7879
var client = new HttpClient();
7980
string str = await client.GetStringAsync("https://marketplace.visualstudio.com/items?itemName=EgorBogatov.Disasmo");
@@ -87,7 +88,7 @@ public static async Task<Version> GetLatestVersionOnline()
8788
public Version GetCurrentVersion()
8889
{
8990
//TODO: fix
90-
return new Version(5, 5, 0);
91+
return new Version(5, 5, 1);
9192

9293
//try
9394
//{

src/Vsix/Properties/Settings.Designer.cs

Lines changed: 13 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Vsix/Properties/Settings.settings

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<Setting Name="ShowAsmComments_V9" Type="System.Boolean" Scope="User">
1212
<Value Profile="(Default)">False</Value>
1313
</Setting>
14-
<Setting Name="CustomEnvVars3_V13" Type="System.String" Scope="User">
15-
<Value Profile="(Default)">DOTNET_JitDiffableDasm=0;;DOTNET_ReadyToRun=1;;</Value>
14+
<Setting Name="CustomEnvVars3_V14" Type="System.String" Scope="User">
15+
<Value Profile="(Default)">DOTNET_JitDiffableDasm=0;;DOTNET_ReadyToRun=1;;DOTNET_TieredPGO_InstrumentOnlyHotCode=0</Value>
1616
</Setting>
1717
<Setting Name="UseDotnetBuildForReload_V9" Type="System.Boolean" Scope="User">
1818
<Value Profile="(Default)">True</Value>
@@ -44,11 +44,11 @@
4444
<Setting Name="UsePGO" Type="System.Boolean" Scope="User">
4545
<Value Profile="(Default)">False</Value>
4646
</Setting>
47-
<Setting Name="CrossgenArgs_V5" Type="System.String" Scope="User">
47+
<Setting Name="CrossgenArgs_V6" Type="System.String" Scope="User">
4848
<Value Profile="(Default)">--targetos windows --targetarch x64 --inputbubble --instruction-set skylake --compilebubblegenerics --parallelism 1 -O</Value>
4949
</Setting>
50-
<Setting Name="IlcArgs_V4" Type="System.String" Scope="User">
51-
<Value Profile="(Default)">-o:nativeaotbin;;-r:%DOTNET_REPO%\artifacts\bin\coreclr\windows.x64.Checked\aotsdk\*.dll;;-r:%DOTNET_REPO%\artifacts\bin\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64\lib\net7.0\*.dll;;-g;;-O;;--initassembly:System.Private.CoreLib;;--initassembly:System.Private.StackTraceMetadata;;--initassembly:System.Private.TypeLoader;;--initassembly:System.Private.Reflection.Execution;;--directpinvokelist:%DOTNET_REPO%\artifacts\bin\coreclr\windows.x64.Checked\build\WindowsAPIs.txt;;--directpinvoke:System.Globalization.Native;;--stacktracedata;;--scanreflection;;--feature:System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=false;;--feature:System.Resources.ResourceManager.AllowCustomResourceTypes=false;;--feature:System.Linq.Expressions.CanCompileToIL=false;;--feature:System.Linq.Expressions.CanEmitObjectArrayDelegate=false;;--feature:System.Linq.Expressions.CanCreateArbitraryDelegates=false</Value>
50+
<Setting Name="IlcArgs_V6" Type="System.String" Scope="User">
51+
<Value Profile="(Default)">-o:nativeaotbin;;-r:%DOTNET_REPO%\artifacts\bin\coreclr\windows.x64.Release\aotsdk\*.dll;;-r:%DOTNET_REPO%\artifacts\bin\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64\lib\net8.0\*.dll;;-g;;-O;;--initassembly:System.Private.CoreLib;;--initassembly:System.Private.StackTraceMetadata;;--initassembly:System.Private.TypeLoader;;--initassembly:System.Private.Reflection.Execution;;--directpinvokelist:%DOTNET_REPO%\artifacts\bin\coreclr\windows.x64.Checked\build\WindowsAPIs.txt;;--directpinvoke:System.Globalization.Native;;--directpinvoke:System.IO.Compression.Native;;--stacktracedata;;--scanreflection;;--feature:System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=false;;--feature:System.Resources.ResourceManager.AllowCustomResourceTypes=false;;--feature:System.Linq.Expressions.CanCompileToIL=false;;--feature:System.Linq.Expressions.CanEmitObjectArrayDelegate=false;;--feature:System.Linq.Expressions.CanCreateArbitraryDelegates=false;;--feature:System.Diagnostics.Tracing.EventSource.IsSupported=false;;</Value>
5252
</Setting>
5353
<Setting Name="UseUnloadableContext" Type="System.Boolean" Scope="User">
5454
<Value Profile="(Default)">False</Value>

src/Vsix/ViewModels/MainViewModel.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,8 @@ public async Task RunFinalExe(DisasmoSymbolInfo symbolInfo)
243243
if (!runtimePackFound)
244244
return;
245245

246-
command = "";
247-
executable = Path.Combine(clrCheckedFilesDir, "crossgen2", "crossgen2.exe");
248-
249-
command += " --out aot ";
246+
executable = Path.Combine(SettingsVm.PathToLocalCoreClr, "dotnet.cmd");
247+
command = $"{Path.Combine(clrCheckedFilesDir, "crossgen2", "crossgen2.dll")} --out aot ";
250248

251249
foreach (var envVar in envVars)
252250
{

src/Vsix/ViewModels/SettingsViewModel.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public SettingsViewModel()
4343
{
4444
PathToLocalCoreClr = Settings.Default.PathToCoreCLR_V9;
4545
ShowAsmComments = Settings.Default.ShowAsmComments_V9;
46-
CustomEnvVars = Settings.Default.CustomEnvVars3_V13.Replace(";;", Environment.NewLine);
47-
Crossgen2Args = Settings.Default.CrossgenArgs_V5;
48-
IlcArgs = Settings.Default.IlcArgs_V4.Replace(";;", Environment.NewLine);
46+
CustomEnvVars = Settings.Default.CustomEnvVars3_V14.Replace(";;", Environment.NewLine);
47+
Crossgen2Args = Settings.Default.CrossgenArgs_V6;
48+
IlcArgs = Settings.Default.IlcArgs_V6.Replace(";;", Environment.NewLine);
4949
JitDumpInsteadOfDisasm = Settings.Default.JitDumpInsteadOfDisasm_V9;
5050
UseDotnetBuildForReload = Settings.Default.UseDotnetBuildForReload_V9;
5151
RunAppMode = Settings.Default.RunAppMode_V9;
@@ -381,7 +381,7 @@ public string CustomEnvVars
381381
set
382382
{
383383
Set(ref _customEnvVars, value);
384-
Settings.Default.CustomEnvVars3_V13 = value;
384+
Settings.Default.CustomEnvVars3_V14 = value;
385385
Settings.Default.Save();
386386
}
387387
}
@@ -392,7 +392,7 @@ public string Crossgen2Args
392392
set
393393
{
394394
Set(ref _crossgen2Args, value);
395-
Settings.Default.CrossgenArgs_V5 = value;
395+
Settings.Default.CrossgenArgs_V6 = value;
396396
Settings.Default.Save();
397397
}
398398
}
@@ -403,7 +403,7 @@ public string IlcArgs
403403
set
404404
{
405405
Set(ref _ilcArgs, value);
406-
Settings.Default.IlcArgs_V4 = value;
406+
Settings.Default.IlcArgs_V6 = value;
407407
Settings.Default.Save();
408408
}
409409
}

0 commit comments

Comments
 (0)