Skip to content

Commit

Permalink
Mark AddBinaryFormattedResource obsolete (dotnet#90346)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericstj authored Aug 11, 2023
1 parent caaed61 commit 624c48d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public sealed partial class PreserializedResourceWriter : System.IDisposable, Sy
public PreserializedResourceWriter(System.IO.Stream stream) { }
public PreserializedResourceWriter(string fileName) { }
public void AddActivatorResource(string name, System.IO.Stream value, string typeName, bool closeAfterWrite = false) { }
[System.ObsoleteAttribute("BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.", DiagnosticId = "SYSLIB0011", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public void AddBinaryFormattedResource(string name, byte[] value, string? typeName = null) { }
public void AddResource(string name, byte[]? value) { }
public void AddResource(string name, System.IO.Stream? value, bool closeAfterWrite = false) { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);RESOURCES_EXTENSIONS</DefineConstants>
<EnableAOTAnalyzer>false</EnableAOTAnalyzer>
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
<IsPackable>true</IsPackable>
<SuggestedBindingRedirectsPackageFile>$(BaseIntermediateOutputPath)SuggestedBindingRedirects.targets</SuggestedBindingRedirectsPackageFile>
<BeforePack>$(BeforePack);GeneratePackageTargetsFile</BeforePack>
Expand All @@ -15,6 +16,8 @@ System.Resources.Extensions.PreserializedResourceWriter</PackageDescription>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(CommonPath)System\Obsoletions.cs"
Link="Common\System\Obsoletions.cs" />
<Compile Include="$(CommonPath)System\Resources\ResourceWriter.cs"
Link="System\Resources\Extensions\ResourceWriter.cs" />
<Compile Include="$(CoreLibSharedDir)System\IO\PinnedBufferMemoryStream.cs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public void AddTypeConverterResource(string name, byte[] value, string typeName)
/// <param name="name">Resource name</param>
/// <param name="value">Value of the resource in byte[] form understood by BinaryFormatter</param>
/// <param name="typeName">Assembly qualified type name of the resource</param>
[Obsolete(Obsoletions.BinaryFormatterMessage, DiagnosticId = Obsoletions.BinaryFormatterDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
public void AddBinaryFormattedResource(string name, byte[] value, string? typeName = null)
{
if (name is null)
Expand Down

0 comments on commit 624c48d

Please sign in to comment.