Skip to content

feat!: update target frameworks to net8.0 and net10.0, drop net5.0 and net6.0#708

Merged
MIchaelMainer merged 11 commits into
mainfrom
mmainer/updateTargetFx
May 6, 2026
Merged

feat!: update target frameworks to net8.0 and net10.0, drop net5.0 and net6.0#708
MIchaelMainer merged 11 commits into
mainfrom
mmainer/updateTargetFx

Conversation

@MIchaelMainer

@MIchaelMainer MIchaelMainer commented May 1, 2026

Copy link
Copy Markdown
Member

PR Summary

Update target frameworks to net8.0 and net10.0, drop net5.0 and net6.0. Updates target frameworks across the solution to align with currently supported .NET runtimes; net10.0 is the current LTS release. Target framework management for the seven common source libraries is consolidated into src/Directory.Build.props to prevent future drift.

Remove obsolete APIs and provided upgrade guide.

Target Framework Changes (includes breaking change to target frameworks)

  • TFMs updated: netstandard2.0;netstandard2.1;net8.0;net10.0 (dropped net5.0 and net6.0)
  • Test projects: Target net10.0 only
  • CI: Updated SDK installs from .NET 6 → .NET 8 (for ESRP signing) + .NET 10, tests run on net10.0

Breaking API Changes

1. IAsyncParseNodeFactory deleted

Merged into IParseNodeFactory, which now has a single async method:

Task<IParseNode> GetRootParseNodeAsync(string contentType, Stream content, CancellationToken cancellationToken = default);

The old synchronous GetRootParseNode() method is removed entirely.

2. Synchronous deserialization methods removed

All synchronous Deserialize/DeserializeCollection methods removed from KiotaSerializer and KiotaJsonSerializer — only async variants remain.

3. MultipartBody overloads removed

GetPartValue<T>(string) and RemovePart(string) removed — the overloads requiring both partName and contentType are kept.

4. ParseNodeFactoryRegistry simplified

Now implements IParseNodeFactory (not IAsyncParseNodeFactory), and GetFactory<T>() simplified to non-generic GetFactory(string contentType).

5. ParseNodeProxyFactory updated

Now implements IParseNodeFactory directly, with only the async GetRootParseNodeAsync method.

6. Serialization library factories updated

JsonParseNodeFactory, FormParseNodeFactory, TextParseNodeFactory now implement IParseNodeFactory instead of IAsyncParseNodeFactory, with only the async method.

Build & Infrastructure

  • Central Package Management added (Directory.Packages.props) consolidating all package versions
  • Package version lower bounds updated to 8.0 for System.Text.Json, System.Diagnostics.DiagnosticSource, etc.
  • Microsoft.CodeAnalysis.PublicApiAnalyzers restricted to run on net8.0 only (avoids false positives from net10.0 source generator differences)
  • Test framework migrated to xunit v3 with Microsoft Testing Platform
  • CLS compliance: Added #pragma warning disable CS3001/CS3002 around sbyte members in interfaces, and [CLSCompliant] attributes

Trim/AOT Safety

  • IL2111 suppression in KiotaDeserializationWrapperFactory.Create (method group loses DynamicallyAccessedMembers annotation)
  • IL2075 suppression in JsonSerializationWriter.WriteNonParsableObjectValue (inherently trim-unsafe reflection path)

Documentation

  • New upgrade-guide-v1-to-v2.md with migration steps, compiler error mappings, and breaking change details

- Suppress IL2111 in KiotaDeserializationWrapperFactory.Create: passing
  CreateInternal as a method group to GetOrAdd loses the
  DynamicallyAccessedMembers annotation on the Type parameter; the
  suppression is safe because callers annotate the type at public API
  boundaries.

- Suppress IL2075 in WriteNonParsableObjectValue: the catch-all
  reflection path over arbitrary object types is inherently trim-unsafe;
  callers requiring AOT/trim compatibility should use the
  KiotaJsonSerializationContext source-generated path.

- Pin PublicApiAnalyzers to net8.0 only: the System.Text.Json source
  generator emits KiotaJsonSerializationContext properties without
  nullable annotations on net10.0, causing false RS0016/RS0041 errors
  against the declared public API. API surface is identical across TFMs
  so running the analyzer on the net8.0 target is sufficient.
@MIchaelMainer MIchaelMainer marked this pull request as ready for review May 1, 2026 23:10
@MIchaelMainer MIchaelMainer requested a review from a team as a code owner May 1, 2026 23:10
MIchaelMainer and others added 2 commits May 1, 2026 17:05
Introduces Directory.Packages.props at the repo root and removes
Version attributes from all PackageReference elements across source
and test projects. All 18 package versions are now managed in a single
place, eliminating the risk of version drift between projects.

System.Diagnostics.DiagnosticSource consolidated from two minimum
floors ([6.0,) and [8.0.1,)) to [8.0.1,) across all references.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
baywet
baywet previously requested changes May 4, 2026

@baywet baywet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As we're making a new major revision, we should also take this opportunity to cleanup the interfaces.
There is the async parse node interface to merge into the regular one and get rid of the sync method.
There is also a cleanup to do with the static serialization methods and overloads for optional parameters.
And generally check for additional to-dos

Comment thread Directory.Packages.props Outdated
Comment thread Directory.Packages.props Outdated
Comment thread src/Directory.Build.props
@github-project-automation github-project-automation Bot moved this to In Progress 🚧 in Kiota May 4, 2026
Update Microsoft.Extensions.DependencyInjection.Abstractions and
System.Text.Json version ranges from [6.0,) to [8.0,) to align with
the minimum supported runtime (net8.0) after dropping net5.0/net6.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MIchaelMainer

MIchaelMainer commented May 4, 2026

Copy link
Copy Markdown
Member Author

I created another PR for:

…Factory (#709)

* refactor(abstractions)!: merge IAsyncParseNodeFactory into IParseNodeFactory

Remove IAsyncParseNodeFactory interface and move GetRootParseNodeAsync
into IParseNodeFactory. Remove the obsolete sync GetRootParseNode method
from the interface. Simplify ParseNodeProxyFactory and
ParseNodeFactoryRegistry to use the unified interface directly.

BREAKING CHANGE: IAsyncParseNodeFactory has been removed. Implement
IParseNodeFactory.GetRootParseNodeAsync directly instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* refactor(abstractions)!: remove obsolete sync deserialization methods

Remove KiotaSerializer.Deserialize, KiotaSerializer.DeserializeCollection,
and their KiotaJsonSerializer counterparts. Only the async variants
(DeserializeAsync, DeserializeCollectionAsync) remain.

BREAKING CHANGE: Sync Deserialize/DeserializeCollection methods have been
removed. Use DeserializeAsync/DeserializeCollectionAsync instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* refactor(serialization): update factory implementations for unified interface

Remove obsolete sync GetRootParseNode from JsonParseNodeFactory,
FormParseNodeFactory, and TextParseNodeFactory. Simplify
HttpClientRequestAdapter to call GetRootParseNodeAsync directly
without runtime type checking.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs(abstractions): update PublicAPI.Shipped.txt for removed APIs

Remove entries for IAsyncParseNodeFactory, sync GetRootParseNode,
sync Deserialize/DeserializeCollection methods, and the generic
GetFactory<T> method. Add entries for the new GetRootParseNodeAsync
on IParseNodeFactory and the non-generic GetFactory method.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: update tests for IParseNodeFactory interface merge

Replace IAsyncParseNodeFactory mocks with IParseNodeFactory. Convert
sync GetRootParseNode calls to async GetRootParseNodeAsync. Update
deserialization tests to use async DeserializeAsync/DeserializeCollectionAsync.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(ci): use glob pattern for coverlet coverage report paths

Coverlet.MTP generates coverage files with a timestamp suffix
(e.g., coverage.opencover.040526233344598.xml) rather than a fixed
filename. Update the SonarCloud workflow to use a glob pattern that
matches the timestamped files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test(abstractions): add tests for ParseNodeProxyFactory.GetRootParseNodeAsync

Verify that the proxy factory:
- Delegates to the concrete factory
- Invokes onBefore/onAfter callbacks
- Preserves original node callbacks alongside proxy callbacks
- Throws ArgumentNullException when concrete is null

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* refactor(abstractions)!: remove deprecated single-param MultipartBody methods

Remove GetPartValue<T>(string) and RemovePart(string) overloads that
were marked with 'TODO: Remove with next major release'. Callers should
use the overloads that accept (partName, fileName) instead.

BREAKING CHANGE: GetPartValue<T>(string) and RemovePart(string) removed

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* chore: fix method order

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread Directory.Packages.props Outdated
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

@MIchaelMainer

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

- Add CLSCompliant assembly attribute to abstractions and http projects
- Retain central package management (no explicit versions)
- Retain updated TFM conditions without net5.0
- Pick up CLSCompliant changes from main (fix: Set CLSCompliant attribute where possible #705)

Co-authored-by: MIchaelMainer <8527305+MIchaelMainer@users.noreply.github.com>

Copilot AI commented May 5, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Merge conflicts resolved in c6176f0. The two conflicting files were:

  • src/abstractions/Microsoft.Kiota.Abstractions.csproj — added CLSCompliantAttribute from main, kept central package management (no explicit version on Microsoft.VisualStudio.Threading.Analyzers)
  • src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj — added CLSCompliantAttribute from main, kept updated TFM conditions without net5.0 and without old explicit version ranges

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@MIchaelMainer

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Merge conflicts resolved in c6176f0. The two conflicting files were:

  • src/abstractions/Microsoft.Kiota.Abstractions.csproj — added CLSCompliantAttribute from main, kept central package management (no explicit version on Microsoft.VisualStudio.Threading.Analyzers)
  • src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj — added CLSCompliantAttribute from main, kept updated TFM conditions without net5.0 and without old explicit version ranges

Same change as in #705

@MIchaelMainer MIchaelMainer enabled auto-merge (squash) May 5, 2026 18:41
Copilot stopped work on behalf of MIchaelMainer due to an error May 5, 2026 18:42
@MIchaelMainer MIchaelMainer disabled auto-merge May 5, 2026 20:48
Covers all breaking changes including:
- Target framework updates (dropped net5.0/net6.0)
- IAsyncParseNodeFactory merged into IParseNodeFactory
- Sync deserialization methods removed from KiotaSerializer
- MultipartBody single-param overloads removed
- Dependency version bumps
- ParseNodeFactoryRegistry API changes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread .azure-pipelines/ci-build.yml
Comment thread src/Directory.Build.props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants