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

Mark AddBinaryFormattedResource obsolete #90346

Merged
merged 1 commit into from
Aug 11, 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
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