Skip to content
Open
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
File renamed without changes.
1 change: 1 addition & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PackageVersion Include="Azure.Core" Version="1.38.0" />
<PackageVersion Include="Azure.Identity" Version="1.11.4" />
<PackageVersion Include="MicroBuild.Core" Version="0.3.1" />
<PackageVersion Include="PolySharp" Version="1.14.1" />
<PackageVersion Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.510501" />
<PackageVersion Include="Microsoft.Identity.Client" Version="4.61.3" />
<PackageVersion Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.61.3" />
Expand Down
479 changes: 240 additions & 239 deletions src/FastSerialization/FastSerialization.cs

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/FastSerialization/FastSerialization.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>net9.0;netstandard2.0</TargetFrameworks>
<RootNamespace>Microsoft.Diagnostics.FastSerialization</RootNamespace>
<AssemblyName>Microsoft.Diagnostics.FastSerialization</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand All @@ -14,6 +14,9 @@
<Version>$(FastSerializationVersion)</Version>
<FileVersion>$(FastSerializationVersion)</FileVersion>
<InformationalVersion>$(FastSerializationVersion)</InformationalVersion>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -27,6 +30,10 @@
<ItemGroup>
<!-- *** SourceLink Support *** -->
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
<PackageReference Include="PolySharp">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<!-- ******************* Signing Support *********************** -->
Expand Down
6 changes: 4 additions & 2 deletions src/FastSerialization/MemoryMappedFileStreamReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// This file is best viewed using outline mode (Ctrl-M Ctrl-O)
//
// This program uses code hyperlinks available as part of the HyperAddin Visual Studio plug-in.
// It is available from http://www.codeplex.com/hyperAddin
//
// It is available from http://www.codeplex.com/hyperAddin
//
using System;
using System.IO;
using System.Text; // For StringBuilder.
Expand All @@ -12,6 +12,7 @@
using System.Runtime.InteropServices;
using DeferedStreamLabel = FastSerialization.StreamLabel;
using System.Diagnostics;
using System.Runtime.Versioning;

namespace FastSerialization
{
Expand All @@ -29,6 +30,7 @@ public class MemoryMappedFileStreamReader : IStreamReader
private long _capacity;
private long _offset;

[SupportedOSPlatform("windows")]
public MemoryMappedFileStreamReader(string mapName, long length, SerializationSettings settings)
: this(MemoryMappedFile.OpenExisting(mapName, MemoryMappedFileRights.Read), length, leaveOpen: false, settings)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System.IO;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Reflection;

namespace Microsoft.Diagnostics.Tracing.AutomatedAnalysis
{
/// <summary>
/// Analyzer resolver that searches the specified directory.
/// </summary>
[RequiresUnreferencedCode("Loads new assemblies")]
public class DirectoryAnalyzerResolver : AnalyzerResolver
{
private static string _baseDirectory;
Expand Down
5 changes: 4 additions & 1 deletion src/TraceEvent/AutomatedAnalysis/IAnalyzerProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

namespace Microsoft.Diagnostics.Tracing.AutomatedAnalysis
{
Expand All @@ -13,14 +15,15 @@ public sealed class AnalyzerProviderAttribute : Attribute
/// Create an new instance of AnalyzerProviderAttribute which stores the Type of the IAnalyzerProvider for the assembly.
/// </summary>
/// <param name="providerType">The type contained in this assembly that implements IAnalyzerProvider.</param>
public AnalyzerProviderAttribute(Type providerType)
public AnalyzerProviderAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type providerType)
{
ProviderType = providerType;
}

/// <summary>
/// The type that implements IAnalyzerProvider.
/// </summary>
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public Type ProviderType { get; }
}

Expand Down
18 changes: 1 addition & 17 deletions src/TraceEvent/Ctf/CtfChannel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -162,23 +163,6 @@ private void ReadHeader()
int bytes = _ctfStream.EventHeader.GetSize();
}

private bool ReadStruct<T>(out T result) where T : struct
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method appears unused

{
int size = Marshal.SizeOf(typeof(T));
int read = TryReadExactlyCount(_buffer, 0, size);

_position += read;

if (size != read)
{
result = default(T);
return false;
}

result = (T)Marshal.PtrToStructure(_handle.AddrOfPinnedObject(), typeof(T));
return true;
}

public override bool CanRead
{
get
Expand Down
2 changes: 1 addition & 1 deletion src/TraceEvent/Ctf/CtfMetadataLegacyParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public unsafe string GetMetadata()
{
// TODO: Currently we read all of metadata and then parse it. We could do better by
// only reading one packet at a time.
byte[] headerBufer = new byte[Marshal.SizeOf(typeof(MetadataPacketHeader))];
byte[] headerBufer = new byte[Marshal.SizeOf<MetadataPacketHeader>()];
byte[] buffer = null;

StringBuilder sb = new StringBuilder();
Expand Down
Loading
Loading