-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[improvement] Removed all usage of reflection, enabled trimming on UW…
…P, improved memory usage when compiling .NET Native (#184) * Removed Android to fix release mode builds * Removed Android to fix release mode builds * WIP enabling trimming * Switched from Newtonsoft to System.Text.Json * Added more types for app settings serialization * Enable 64 bit compiler in release mode * Switched to System.Text.Json + source generators * Fixed compilation errors from refactor * Exclude all metadata by default * Use x64 for PreferredToolArchitecture * Removed "Prefer32Bit" property * Revert Microsoft.NETCore.UniversalWindowsPlatform to match MSBuild.Sdk.Extras (6.2.10) * Updated to .NET 7 preview for Microsoft.CodeAnalysis.NetAnalyzers * Remove explicit "Excluded" for *Application* runtime directive * Remove ShortcutGenericAnalysis * Remove potential infinite loop * Set the optimizer as single threaded. * Set the optimizer as single threaded for Release all platforms * Refactored and cleaned up UWP csproj * Enabled ShortcutGenericAnalysis in release mode * Enable generating PDB out of process and bump .NET Native to 6.2.14 * Revert "Enable generating PDB out of process and bump .NET Native to 6.2.14" This reverts commit 5818a2e. * Revert "Revert "Enable generating PDB out of process and bump .NET Native to 6.2.14"" This reverts commit 200705c. Co-authored-by: amaidniazi <[email protected]>
- Loading branch information
1 parent
f1383fe
commit e7d2fae
Showing
54 changed files
with
648 additions
and
845 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Cores/Files/StrixMusic.Cores.LocalFiles/LocalFilesCoreConfigPanel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/Cores/Files/StrixMusic.Cores.LocalFiles/Settings/FilesCoreSettingsSerializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.IO; | ||
using System.Text.Json; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using CommunityToolkit.Diagnostics; | ||
using OwlCore.Services; | ||
|
||
namespace StrixMusic.Cores.LocalFiles.Settings | ||
{ | ||
/// <summary> | ||
/// An <see cref="IAsyncSerializer{TSerialized}"/> and implementation for serializing and deserializing streams using System.Text.Json. | ||
/// </summary> | ||
public class FilesCoreSettingsSerializer : IAsyncSerializer<Stream> | ||
{ | ||
/// <summary> | ||
/// A singleton instance for <see cref="FilesCoreSettingsSerializer"/>. | ||
/// </summary> | ||
public static FilesCoreSettingsSerializer Singleton { get; } = new(); | ||
|
||
/// <inheritdoc /> | ||
public async Task<Stream> SerializeAsync<T>(T data, CancellationToken? cancellationToken = null) | ||
{ | ||
var stream = new MemoryStream(); | ||
await JsonSerializer.SerializeAsync(stream, data, typeof(T), context: FilesCoreSettingsSerializerContext.Default, cancellationToken: cancellationToken ?? CancellationToken.None); | ||
return stream; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public async Task<Stream> SerializeAsync(Type inputType, object data, CancellationToken? cancellationToken = null) | ||
{ | ||
var stream = new MemoryStream(); | ||
await JsonSerializer.SerializeAsync(stream, data, inputType, context: FilesCoreSettingsSerializerContext.Default, cancellationToken: cancellationToken ?? CancellationToken.None); | ||
return stream; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public async Task<TResult> DeserializeAsync<TResult>(Stream serialized, CancellationToken? cancellationToken = null) | ||
{ | ||
var result = await JsonSerializer.DeserializeAsync(serialized, typeof(TResult), FilesCoreSettingsSerializerContext.Default); | ||
Guard.IsNotNull(result); | ||
return (TResult)result; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public async Task<object> DeserializeAsync(Type returnType, Stream serialized, CancellationToken? cancellationToken = null) | ||
{ | ||
var result = await JsonSerializer.DeserializeAsync(serialized, returnType, FilesCoreSettingsSerializerContext.Default); | ||
Guard.IsNotNull(result); | ||
return result; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Cores/Files/StrixMusic.Cores.LocalFiles/Settings/FilesCoreSettingsSerializerContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace StrixMusic.Cores.LocalFiles.Settings | ||
{ | ||
/// <summary> | ||
/// Supplies type information for settings values in <see cref="LocalFilesCoreSettings"/>. | ||
/// </summary> | ||
[JsonSourceGenerationOptions(WriteIndented = true)] | ||
[JsonSerializable(typeof(bool))] | ||
[JsonSerializable(typeof(string))] | ||
internal partial class FilesCoreSettingsSerializerContext : JsonSerializerContext | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/Cores/Files/StrixMusic.Cores.OneDrive/Services/FilesCoreSettingsSerializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.IO; | ||
using System.Text.Json; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using CommunityToolkit.Diagnostics; | ||
using OwlCore.Services; | ||
|
||
namespace StrixMusic.Cores.OneDrive.Services | ||
{ | ||
/// <summary> | ||
/// An <see cref="IAsyncSerializer{TSerialized}"/> and implementation for serializing and deserializing streams using System.Text.Json. | ||
/// </summary> | ||
public class FilesCoreSettingsSerializer : IAsyncSerializer<Stream> | ||
{ | ||
/// <summary> | ||
/// A singleton instance for <see cref="FilesCoreSettingsSerializer"/>. | ||
/// </summary> | ||
public static FilesCoreSettingsSerializer Singleton { get; } = new(); | ||
|
||
/// <inheritdoc /> | ||
public async Task<Stream> SerializeAsync<T>(T data, CancellationToken? cancellationToken = null) | ||
{ | ||
var stream = new MemoryStream(); | ||
await JsonSerializer.SerializeAsync(stream, data, typeof(T), context: FilesCoreSettingsSerializerContext.Default, cancellationToken: cancellationToken ?? CancellationToken.None); | ||
return stream; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public async Task<Stream> SerializeAsync(Type inputType, object data, CancellationToken? cancellationToken = null) | ||
{ | ||
var stream = new MemoryStream(); | ||
await JsonSerializer.SerializeAsync(stream, data, inputType, context: FilesCoreSettingsSerializerContext.Default, cancellationToken: cancellationToken ?? CancellationToken.None); | ||
return stream; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public async Task<TResult> DeserializeAsync<TResult>(Stream serialized, CancellationToken? cancellationToken = null) | ||
{ | ||
var result = await JsonSerializer.DeserializeAsync(serialized, typeof(TResult), FilesCoreSettingsSerializerContext.Default); | ||
Guard.IsNotNull(result); | ||
return (TResult)result; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public async Task<object> DeserializeAsync(Type returnType, Stream serialized, CancellationToken? cancellationToken = null) | ||
{ | ||
var result = await JsonSerializer.DeserializeAsync(serialized, returnType, FilesCoreSettingsSerializerContext.Default); | ||
Guard.IsNotNull(result); | ||
return result; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Cores/Files/StrixMusic.Cores.OneDrive/Services/FilesCoreSettingsSerializerContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace StrixMusic.Cores.OneDrive.Services | ||
{ | ||
/// <summary> | ||
/// Supplies type information for settings values in <see cref="LocalFilesCoreSettings"/>. | ||
/// </summary> | ||
[JsonSourceGenerationOptions(WriteIndented = true)] | ||
[JsonSerializable(typeof(bool))] | ||
[JsonSerializable(typeof(string))] | ||
internal partial class FilesCoreSettingsSerializerContext : JsonSerializerContext | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/Platforms/StrixMusic.Droid/Properties/AndroidManifest.xml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.