ManagementDateTimeConverter.ToDateTime 返回本地时间

DateTime返回的ManagementDateTimeConverter.ToDateTime(String)值现在基于本地时区。

已引入的版本

.NET 8 RC 1

以前的行为

以前,ManagementDateTimeConverter.ToDateTime(String) 会返回一个其 DateTime.Kind 值为 DateTimeKind.Unspecified 的值。

新行为

从 .NET 8 开始,ManagementDateTimeConverter.ToDateTime(String) 返回一个值,它的 DateTime.Kind 值是 DateTimeKind.Local

破坏性变更的类型

此更改为行为更改

更改原因

进行了此更改,使代码与文档所说的内容相匹配。

如果代码预期返回的值基于未指定的时区,请将其更新为预期基于本地时区的值。

受影响的 API