Skip to content
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
3 changes: 2 additions & 1 deletion docs/core/compatibility/7.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ If you're migrating an app to .NET 7, the breaking changes listed here might aff
| [AllowRenegotiation default is false](networking/7.0/allowrenegotiation-default.md) | ❌ | ❌ | Preview 3 |
| [Custom ping payloads on Linux](networking/7.0/ping-custom-payload-linux.md) | ❌ | ✔️ | Preview 2 |

## SDK
## SDK and MSBuild

| Title | Binary compatible | Source compatible | Introduced |
| - | :-: | :-: | - |
| [Version requirements for .NET 7 SDK](sdk/7.0/vs-msbuild-version.md) | ✔️ | ✔️ | 7.0.100 |
| [MSBuild serialization of custom types in .NET 7](sdk/7.0/custom-serialization.md) | ❌ | ❌ | 7.0.100 |

## Serialization

Expand Down
32 changes: 32 additions & 0 deletions docs/core/compatibility/sdk/7.0/custom-serialization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: "Breaking change: Serialization of custom types in .NET 7"
description: Learn about a breaking change in MSBuild for .NET 7 where serialization using BinaryFormatter of certain user-defined types is removed.
author: baronfel
ms.date: 05/06/2022
---

# BinaryFormatter serialization of custom BuildEventArgs and ITaskItems removed for .NET 7

MSBuild in .NET 7 doesn't support serialization of custom `BuildEventArgs`-derived and `ITaskItem`-derived types via the `BinaryFormatter` serializer.

## Version introduced

MSBuild 17.4 (.NET SDK 7.0.100)

## Old behavior

MSBuild used BinaryFormatter to preserve custom types that derived from BuildEventArgs and ITaskItem across certain boundaries, most notably when running in a multi-process environment.

## New behavior

MSBuild will no longer support this mechanism, so code that used custom types derived from BuildEventArgs and ITaskItem may fail.

## Reason for change

BinaryFormatter was [made obsolete in .NET 5](https://github.com/dotnet/designs/blob/main/accepted/2020/better-obsoletion/binaryformatter-obsoletion.md). Per this plan, all first-party code in the dotnet GitHub organization must migrate away from its use by .NET 7. This change impacts user-exposed functionality of MSBuild.

## Recommended action

* Engage with the MSBuild team on [this GitHub discussion](https://github.com/dotnet/msbuild/discussions/7582) about your specific use cases and how you can migrate away from the `TranslateDotNet` mechanism.

* Avoid returning custom derived types from tasks or when logging.
6 changes: 5 additions & 1 deletion docs/core/compatibility/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ items:
href: networking/7.0/allowrenegotiation-default.md
- name: Custom ping payloads on Linux
href: networking/7.0/ping-custom-payload-linux.md
- name: SDK
- name: SDK and MSBuild
items:
- name: Version requirements for .NET 7 SDK
href: sdk/7.0/vs-msbuild-version.md
- name: Serialization of custom types in .NET 7
href: sdk/7.0/custom-serialization.md
- name: Serialization
items:
- name: Deserialize Version type with leading or trailing whitespace
Expand Down Expand Up @@ -965,6 +967,8 @@ items:
items:
- name: Version requirements for .NET 7 SDK
href: sdk/7.0/vs-msbuild-version.md
- name: Serialization of custom types in .NET 7
href: sdk/7.0/custom-serialization.md
- name: .NET 6
items:
- name: -p option for `dotnet run` is deprecated
Expand Down