Skip to content

Commit

Permalink
Remove BinaryFormatter snippets and articles (dotnet#33122)
Browse files Browse the repository at this point in the history
  • Loading branch information
gewarren authored Dec 21, 2022
1 parent 083c589 commit 0f5ecf3
Show file tree
Hide file tree
Showing 49 changed files with 469 additions and 1,376 deletions.
8 changes: 8 additions & 0 deletions .openpublishing.redirection.framework.json
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,10 @@
"source_path_from_root": "/docs/framework/wcf/feature-details/context-exchange-correlation.md",
"redirect_url": "/previous-versions/dotnet/netframework-4.0/ee358724(v=vs.100)"
},
{
"source_path_from_root": "/docs/framework/wcf/feature-details/controlling-serialization-and-deserialization-with-serializationbinder.md",
"redirect_url": "/dotnet/framework/wcf/feature-details/data-transfer-and-serialization"
},
{
"source_path_from_root": "/docs/framework/wcf/feature-details/how-to-create-a-workflow-service-that-calls-another-workflow-service.md",
"redirect_url": "/previous-versions/dotnet/netframework-4.0/ff729672(v=vs.100)"
Expand Down Expand Up @@ -1798,6 +1802,10 @@
"source_path_from_root": "/docs/framework/wcf/samples/transacted-batching.md",
"redirect_url": "/previous-versions/dotnet/netframework-4.0/aa395219(v%3dvs.100)"
},
{
"source_path_from_root": "/docs/framework/wcf/samples/usage-of-serialization-binder.md",
"redirect_url": "/dotnet/framework/wcf/samples/"
},
{
"source_path_from_root": "/docs/framework/wcf/samples/web-extensibility.md",
"redirect_url": "/previous-versions/dotnet/netframework-4.0/ee818234(v%3dvs.100)"
Expand Down
4 changes: 4 additions & 0 deletions .openpublishing.redirection.standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@
"source_path_from_root": "/docs/standard/guidance-architecture.md",
"redirect_url": "/dotnet/architecture/index"
},
{
"source_path_from_root": "/docs/standard/serialization/how-to-determine-if-netstandard-object-is-serializable.md",
"redirect_url": "/dotnet/standard/serialization/binaryformatter-security-guide"
},
{
"source_path_from_root": "/docs/standard/index.yml",
"redirect_url": "/dotnet/fundamentals/"
Expand Down
4 changes: 4 additions & 0 deletions .openpublishing.redirection.visual-basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,10 @@
"source_path_from_root": "/docs/visual-basic/programming-guide/concepts/threading/walkthrough-multithreading-with-the-backgroundworker-component.md",
"redirect_url": "/dotnet/api/system.componentmodel.backgroundworker"
},
{
"source_path_from_root": "/docs/visual-basic/programming-guide/concepts/serialization/walkthrough-persisting-an-object-in-visual-studio.md",
"redirect_url": "/dotnet/visual-basic/programming-guide/concepts/serialization/"
},
{
"source_path_from_root": "/docs/visual-basic/programming-guide/language-features/xml/how-to-enable-xml-intellisense.md",
"redirect_url": "/previous-versions/visualstudio/visual-studio-2013/bb531402(v=vs.120)"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ To generate classes from schemas that are usable with Windows Communication Foun

This corresponds to the **/serializable** switch on the `Svcutil.exe` tool.

Sometimes it is important for the types generated from the schema to be usable with .NET Framework runtime serialization engines (for example, the <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter?displayProperty=nameWithType> and the <xref:System.Runtime.Serialization.Formatters.Soap.SoapFormatter> classes). This is useful when using types for .NET Framework remoting. To enable this, you must apply the <xref:System.SerializableAttribute> attribute to the generated types in addition to the regular <xref:System.Runtime.Serialization.DataContractAttribute> attribute. The attribute is generated automatically if the `GenerateSerializable` import option is set to `true`.
Sometimes it is important for the types generated from the schema to be usable with .NET Framework runtime serialization engines. This is useful when using types for .NET Framework remoting. To enable this, you must apply the <xref:System.SerializableAttribute> attribute to the generated types in addition to the regular <xref:System.Runtime.Serialization.DataContractAttribute> attribute. The attribute is generated automatically if the `GenerateSerializable` import option is set to `true`.

The following example shows the `Vehicle` class generated with the `GenerateSerializable` import option set to `true`.

Expand Down
3 changes: 1 addition & 2 deletions docs/framework/wcf/feature-details/toc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
items:
- name: WCF Feature Details
href: index.md
items:
Expand Down Expand Up @@ -159,8 +160,6 @@
href: importing-schema-to-generate-classes.md
- name: Exporting Schemas from Classes
href: exporting-schemas-from-classes.md
- name: Controlling Serialization and Deserialization with SerializationBinder
href: controlling-serialization-and-deserialization-with-serializationbinder.md
- name: Using a Data Contract Resolver
href: using-a-data-contract-resolver.md
- name: Using the XmlSerializer Class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ The data contract programming model fully supports the version-tolerant serializ

There are four callback attributes. Each attribute can be applied to a method that the serialization/deserialization engine calls at various times. The table below explains when to use each attribute.

|Attribute|When the corresponding method is called|
|---------------|---------------------------------------------|
|<xref:System.Runtime.Serialization.OnSerializingAttribute>|Called before serializing the type.|
|<xref:System.Runtime.Serialization.OnSerializedAttribute>|Called after serializing the type.|
|<xref:System.Runtime.Serialization.OnDeserializingAttribute>|Called before deserializing the type.|
|<xref:System.Runtime.Serialization.OnDeserializedAttribute>|Called after deserializing the type.|
| Attribute | When the corresponding method is called |
| ------------------------------------------------------------ | --------------------------------------- |
| <xref:System.Runtime.Serialization.OnSerializingAttribute> | Called before serializing the type. |
| <xref:System.Runtime.Serialization.OnSerializedAttribute> | Called after serializing the type. |
| <xref:System.Runtime.Serialization.OnDeserializingAttribute> | Called before deserializing the type. |
| <xref:System.Runtime.Serialization.OnDeserializedAttribute> | Called after deserializing the type. |

The methods must accept a <xref:System.Runtime.Serialization.StreamingContext> parameter.

Expand Down
3 changes: 0 additions & 3 deletions docs/framework/wcf/samples/data-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,3 @@ Demonstrates how to pass objects by references between server and client.

[POCO Support](poco-support.md)
Demonstrates the serialization support for unmarked types; that is, types to which serialization attributes have not been applied, sometimes referred to as Plain Old CLR Object (POCO) types.

[Usage of Serialization Binder](usage-of-serialization-binder.md)
This sample shows how to use the <xref:System.Runtime.Serialization.SerializationBinder> to change the version of a generic type when it is serialized.
3 changes: 1 addition & 2 deletions docs/framework/wcf/samples/toc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
items:
- name: Windows Communication Foundation Samples
href: index.md
items:
Expand Down Expand Up @@ -175,8 +176,6 @@
href: object-references.md
- name: POCO Support
href: poco-support.md
- name: Usage of Serialization Binder
href: usage-of-serialization-binder.md
- name: Message Contracts
href: message-contracts.md
items:
Expand Down
31 changes: 0 additions & 31 deletions docs/framework/wcf/samples/usage-of-serialization-binder.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/framework/windows-workflow-foundation/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ms.assetid: 67d2b3e8-3777-49f8-9084-abbb33b5a766

### Control Flow

Just as in any programming language, WF provides support for control flows for workflow definitions by introducing a set of control flow activities for sequencing, looping, branching and other patterns. In WF3, when the same activity needs to be re-executed, a new <xref:System.Workflow.ComponentModel.ActivityExecutionContext> is created and the activity is cloned through a heavy-weight serialization and deserialization logic based on <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter>. Usually the performance for iterative control flows is much slower than executing a sequence of activities.
Just as in any programming language, WF provides support for control flows for workflow definitions by introducing a set of control flow activities for sequencing, looping, branching, and other patterns. In WF3, when the same activity needs to be re-executed, a new <xref:System.Workflow.ComponentModel.ActivityExecutionContext> is created and the activity is cloned through a heavy-weight serialization and deserialization logic based on <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter>. Usually the performance for iterative control flows is much slower than executing a sequence of activities.

WF4 handles this quite differently. It takes the activity template, creates a new ActivityInstance object, and adds it to the scheduler queue. This whole process only involves explicit object creation and is very lightweight.

Expand Down
2 changes: 1 addition & 1 deletion docs/fundamentals/code-analysis/quality-rules/ca2305.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This rule finds <xref:System.Web.UI.LosFormatter?displayProperty=nameWithType> d

## How to fix violations

- Use a secure serializer instead, and **don't allow an attacker to specify an arbitrary type to deserialize**. For more information see the [Preferred alternatives](../../../standard/serialization/binaryformatter-security-guide.md#preferred-alternatives).
- Use a secure serializer instead, and **don't allow an attacker to specify an arbitrary type to deserialize**. For more information see [Preferred alternatives](../../../standard/serialization/binaryformatter-security-guide.md#preferred-alternatives).
- Make the serialized data tamper-proof. After serialization, cryptographically sign the serialized data. Before deserialization, validate the cryptographic signature. Protect the cryptographic key from being disclosed and design for key rotations.

## When to suppress warnings
Expand Down
11 changes: 5 additions & 6 deletions docs/fundamentals/code-analysis/quality-rules/ca2321.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ dev_langs:
- VB
f1_keywords:
- "CA2321"
- "DoNotCallBinaryFormatterDeserializeWithoutFirstSettingBinaryFormatterBinder"
---
# CA2321: Do not deserialize with JavaScriptSerializer using a SimpleTypeResolver

| | Value |
|-|-|
| **Rule ID** |CA2321|
| **Category** |[Security](security-warnings.md)|
| **Fix is breaking or non-breaking** |Non-breaking|
| | Value |
| ----------------------------------- | -------------------------------- |
| **Rule ID** | CA2321 |
| **Category** | [Security](security-warnings.md) |
| **Fix is breaking or non-breaking** | Non-breaking |

## Cause

Expand Down
4 changes: 2 additions & 2 deletions docs/orleans/host/configuration-guide/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ The rules are:

Orleans supports transmission of arbitrary types at runtime and therefore the in-built code generator cannot determine the entire set of types that will be transmitted ahead of time. Additionally, certain types cannot have serializers generated for them because they are inaccessible (for example, `private`) or have inaccessible fields (for example, `readonly`). Therefore, there is a need for just-in-time serialization of types that were unexpected or could not have serializers generated ahead of time. The serializer responsible for these types is called the *fallback serializer*. Orleans ships with two fallback serializers:

* <xref:Orleans.Serialization.BinaryFormatterSerializer?displayProperty=fullName> which uses .NET's <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter>; and
* <xref:Orleans.Serialization.ILBasedSerializer?displayProperty=fullName> which emits [CIL](../../../standard/glossary.md#il) instructions at runtime to create serializers that leverage Orleans' serialization framework to serialize each field. This means that if an inaccessible type `MyPrivateType` contains a field `MyType` which has a custom serializer, that custom serializer will be used to serialize it.
* <xref:Orleans.Serialization.BinaryFormatterSerializer?displayProperty=fullName>, which uses .NET's <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter>; and
* <xref:Orleans.Serialization.ILBasedSerializer?displayProperty=fullName>, which emits [CIL](../../../standard/glossary.md#il) instructions at runtime to create serializers that leverage Orleans' serialization framework to serialize each field. This means that if an inaccessible type `MyPrivateType` contains a field `MyType` which has a custom serializer, that custom serializer will be used to serialize it.

The fallback serializer can be configured using the <xref:Orleans.Configuration.SerializationProviderOptions.FallbackSerializationProvider> property on both <xref:Orleans.Runtime.Configuration.ClientConfiguration> on the client and <xref:Orleans.Runtime.Configuration.GlobalConfiguration> on the silos.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: "Learn more about: How to: Round-trip Date and Time Values"
title: "How to: Round-trip Date and Time Values"
description: "Learn how to round-trip date and time values"
ms.date: 11/15/2022
dev_langs:
- "csharp"
Expand All @@ -12,7 +12,7 @@ helpviewer_keywords:
- "formatting strings [.NET], round-trip values"
ms.assetid: b609b277-edc6-4c74-b03e-ea73324ecbdb
---
# How to: Round-trip Date and Time Values
# How to: Round-trip Date and time values

In many applications, a date and time value is intended to unambiguously identify a single point in time. This article shows how to save and restore a <xref:System.DateTime> value, a <xref:System.DateTimeOffset> value, and a date and time value with time zone information so that the restored value identifies the same time as the saved value.

Expand Down
2 changes: 1 addition & 1 deletion docs/standard/language-independence.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ Constructors in CLS-compliant classes and structures must follow these rules:
[!code-csharp[Conceptual.CLSCompliant#11](../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.clscompliant/cs/ctor1.cs#11)]
[!code-vb[Conceptual.CLSCompliant#11](../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.clscompliant/vb/ctor1.vb#11)]

* An object constructor cannot be called except to create an object. In addition, an object cannot be initialized twice. For example, this means that <xref:System.Object.MemberwiseClone%2A?displayProperty=nameWithType> and deserialization methods such as <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize%2A?displayProperty=nameWithType> must not call constructors.
* An object constructor cannot be called except to create an object. In addition, an object cannot be initialized twice. For example, this means that <xref:System.Object.MemberwiseClone%2A?displayProperty=nameWithType> and deserialization methods must not call constructors.

### Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This functionality is not a substitute for a <xref:System.Runtime.Serialization.

## Description of events

The `BinaryFormatter` event source has the well-known name `System.Runtime.Serialization.Formatters.Binary.BinaryFormatterEventSource`. Listeners may subscribe to 6 events.
The `BinaryFormatter` event source has the well-known name `System.Runtime.Serialization.Formatters.Binary.BinaryFormatterEventSource`. Listeners can subscribe to six events.

### SerializationStart event (id = `10`)

Expand Down
Loading

0 comments on commit 0f5ecf3

Please sign in to comment.