Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to .NET 8 #260

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
build-dir: net48
- platform: net-x86
package-name: net-win32
build-dir: net6.0-windows\win-x86\publish
build-dir: net8.0-windows\win-x86\publish
- platform: net-x64
package-name: net-win64
build-dir: net6.0-windows\win-x64\publish
build-dir: net8.0-windows\win-x64\publish

steps:
- uses: actions/[email protected]
Expand All @@ -39,7 +39,7 @@ jobs:

- uses: actions/[email protected]
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
dotnet-quality: ga

- uses: microsoft/[email protected]
Expand Down
9 changes: 6 additions & 3 deletions DnSpyCommon.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- .github/workflows/build.yml
- DnSpyRoslyn.props
NOTE: Update the ABOVE files when TargetFrameworks is updated -->
<TargetFrameworks>net48;net6.0-windows</TargetFrameworks>
<TargetFrameworks>net48;net8.0-windows</TargetFrameworks>
<IsDotNetFramework>false</IsDotNetFramework>
<IsDotNet>false</IsDotNet>
<IsSelfContainedDotNet>false</IsSelfContainedDotNet>
Expand Down Expand Up @@ -35,11 +35,13 @@
<DnSpyAssemblyVersion>6.4.1.0</DnSpyAssemblyVersion>
<!-- This is shown in the title bar -->
<DnSpyAssemblyInformationalVersion>v6.4.1</DnSpyAssemblyInformationalVersion>
<!-- Prevent .NET SDK from appening the git commit hash to the information version -->
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<DnSpyAssemblyCopyright>Copyright (C) 2014-2020 [email protected]</DnSpyAssemblyCopyright>

<!-- AD0001: buggy Roslyn analyzer(s) crash, disable that warning -->
<!-- WFAC010: Prevent warning about app.manifest properties -->
<NoWarn>NU1701;AD0001;WFAC010</NoWarn>
<NoWarn>NU1701;AD0001;WFAC010;NETSDK1189</NoWarn>
<NoWarn Condition=" '$(IsDotNetFramework)' == 'true' ">$(NoWarn);CS8767</NoWarn>

<!-- Update app.config whenever some of these versions change (eg. dnlib version) -->
Expand All @@ -54,8 +56,9 @@
<NewtonsoftJsonVersion>13.0.3</NewtonsoftJsonVersion>
<OokiiDialogsWpfVersion>5.0.1</OokiiDialogsWpfVersion>
<RoslynVersion>4.7.0</RoslynVersion>
<SCCompositionVersion>7.0.0</SCCompositionVersion>
<SCCompositionVersion>8.0.0</SCCompositionVersion>
<NuGetVersion>6.7.0</NuGetVersion>
<DbgShimVersion>8.0.452401</DbgShimVersion>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)Build\ConvertToNetstandardReferences\ConvertToNetstandardReferences.tasks" Condition=" '$(IsDotNet)' == 'true' " />
Expand Down
2 changes: 1 addition & 1 deletion DnSpyRoslyn.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="DnSpyCommon.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0-windows</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0-windows</TargetFrameworks>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,17 @@ static bool TryGetInstallLocationFromRegistry(string regPath, [NotNullWhen(true)
}

public static string GetDebugShimFilename(int bitness) {
#if NETFRAMEWORK
var filename = FileUtilities.GetNativeDllFilename("dbgshim");
var basePath = Contracts.App.AppDirectories.BinDirectory;
#if NETFRAMEWORK
basePath = Path.Combine(basePath, "debug", "core");
var filename = FileUtilities.GetNativeDllFilename("dbgshim");
switch (bitness) {
case 32: return Path.Combine(basePath, "x86", filename);
case 64: return Path.Combine(basePath, "x64", filename);
default: throw new ArgumentOutOfRangeException(nameof(bitness));
}
#elif NET
var filename = FileUtilities.GetNativeDllFilename("dbgshim");
return Path.Combine(Path.GetDirectoryName(typeof(void).Assembly.Location)!, filename);
return Path.Combine(basePath, "runtimes", RuntimeInformation.RuntimeIdentifier, "native", filename);
#else
#error Unknown target framework
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<PackageReference Include="Iced" Version="$(IcedVersion)" />
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="$(MSDiagRuntimeVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Text.UI.Wpf" Version="$(MSVSTextVersion)" />
<PackageReference Include="Microsoft.Diagnostics.DbgShim" Version="$(DbgShimVersion)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,5 @@ public InterpreterMessageException(string message) : base(message) { }
/// <param name="message">Error message</param>
/// <param name="innerException">Other exception</param>
public InterpreterMessageException(string message, Exception innerException) : base(message, innerException) { }

/// <summary>
/// Constructor
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
protected InterpreterMessageException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
2 changes: 1 addition & 1 deletion Extensions/dnSpy.Debugger/netcorefiles
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ param(
$ErrorActionPreference = 'Stop'

$netframework_tfm = 'net48'
$net_tfm = 'net6.0-windows'
$net_tfm = 'net8.0-windows'
$configuration = 'Release'
$net_baseoutput = "dnSpy\dnSpy\bin\$configuration"
$apphostpatcher_dir = "Build\AppHostPatcher"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public DontDeserializeType(SerializationInfo info, StreamingContext context) {
}

public static Dictionary<string, DeserializedDataInfo> Deserialize(string asmName, string typeName, byte[] data) {
#pragma warning disable SYSLIB0011
var fmt = new BinaryFormatter();
fmt.Binder = new MyBinder(asmName, typeName);
#pragma warning disable SYSLIB0011
var obj = fmt.Deserialize(new MemoryStream(data)) as DeserializedType;
#pragma warning restore SYSLIB0011
Debug2.Assert(obj is not null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ static ResourceElement CreateSerializedImage(Stream stream, string filename) {
/// </summary>
/// <param name="obj">Data</param>
/// <returns></returns>
public static byte[] Serialize(object obj) {
public static byte[] Serialize(object? obj) {
if (obj is null)
return Array.Empty<byte>();

//TODO: The asm names of the saved types are saved in the serialized data. If the current
// module is eg. a .NET 2.0 asm, you should replace the versions from 4.0.0.0 to 2.0.0.0.
#pragma warning disable SYSLIB0011
var formatter = new BinaryFormatter();
var outStream = new MemoryStream();
#pragma warning disable SYSLIB0011
formatter.Serialize(outStream, obj);
#pragma warning restore SYSLIB0011
return outStream.ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ public static string CheckCanUpdateData(ModuleDef? module, ResourceElement newRe
/// <returns></returns>
public static ImageListOptions ReadImageData(byte[] imageData) {
var imageList = new ImageList();
#pragma warning disable SYSLIB0050
var info = new SerializationInfo(typeof(ImageListStreamer), new FormatterConverter());
info.AddValue("Data", imageData);
var ctor = typeof(ImageListStreamer).GetConstructor(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(SerializationInfo), typeof(StreamingContext) }, null);
if (ctor is null)
throw new InvalidOperationException();
var streamer = (ImageListStreamer)ctor.Invoke(new object[] { info, new StreamingContext(StreamingContextStates.All) });
#pragma warning restore SYSLIB0050
imageList.ImageStream = streamer;

var opts = new ImageListOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ public void Deserialize() {
var binaryResourceData = ((BinaryResourceData)ResourceElement.ResourceData);
var serializedData = binaryResourceData.Data;
if (binaryResourceData.Format == SerializationFormat.BinaryFormatter) {
#pragma warning disable SYSLIB0011
var formatter = new BinaryFormatter();
try {
#pragma warning disable SYSLIB0011
deserializedData = formatter.Deserialize(new MemoryStream(serializedData));
#pragma warning restore SYSLIB0011
}
catch {
return;
}
#pragma warning restore SYSLIB0011
}
else if (binaryResourceData.Format == SerializationFormat.TypeConverterByteArray) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ public sealed class NormalizedHexSpanCollection : ReadOnlyCollection<HexSpan>, I
/// <summary>
/// An empty collection
/// </summary>
#if NETFRAMEWORK
public static readonly NormalizedHexSpanCollection Empty = new NormalizedHexSpanCollection();
#else
public new static readonly NormalizedHexSpanCollection Empty = new NormalizedHexSpanCollection();
#endif

/// <summary>
/// Constructor
Expand Down
Loading