Skip to content

Commit 63b92bc

Browse files
authored
Merge pull request #9303 from haywoodsloan/dotnet-freshness-2025-batch2
CI#6370: .NET Framework freshness review - Batch 2
2 parents 77fa9cf + aa703f5 commit 63b92bc

6 files changed

+116
-96
lines changed
Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
---
2-
title: KB2998527 causes wrong code lookups on past dates
3-
description: This article explains the problem where update 2998527 causes incorrect code lookups on past dates when the application use TimeZoneInfo.
4-
ms.date: 05/08/2020
2+
title: KB2998527 Causes Wrong Code Lookups on Past Dates
3+
description: This article explains how update 2998527 causes incorrect code lookups on past dates when an application uses TimeZoneInfo.
4+
ms.date: 07/08/2025
55
ms.reviewer: leecow
66
ms.custom: sap:Class Library Namespaces
7+
ms.topic: troubleshooting-problem-resolution
8+
#customer intent: As a developer, I want to fix incorrect code lookups on past dates when I use the TimeZoneInfo class so that my application handles time zones correctly.
79
---
810
# Update 2998527 causes incorrect code lookups on past dates
911

10-
This article explains the problem where [KB 2998527](https://support.microsoft.com/help/2998527) causes incorrect code lookups on past dates when you use the `TimeZoneInfo` class in an application.
12+
This article describes an issue where installing the [Microsoft KB 2998527](https://support.microsoft.com/help/2998527) update can cause the `TimeZoneInfo` class to return incorrect results for past date lookups in applications.
1113

12-
_Original product version:_   .NET Framework 4.6, 4.5
13-
_Original KB number:_   3012229
14+
_Applies to:_ .NET Framework 4.6, 4.5
15+
16+
_Original KB number:_ 3012229
1417

1518
## Symptoms
1619

17-
After October 26, 2014, applications that are hosted on systems that have the September 2014 Russian time zone update ([KB 2998527](https://support.microsoft.com/help/2998527)) installed and that use the Microsoft .NET Framework might calculate time incorrectly when they use the `TimeZoneInfo` class.
20+
After October 26, 2014, applications that are hosted on systems that have the September 2014 Russian time zone update ([KB 2998527](https://support.microsoft.com/help/2998527)) installed and that use Microsoft .NET Framework might calculate time incorrectly when they use the `TimeZoneInfo` class.
1821

1922
This problem occurs in the following time zones:
2023

@@ -33,28 +36,28 @@ This problem occurs in the following time zones:
3336
- (UTC+10:00) Vladivostok, Magadan (RTZ 9)
3437
- (UTC+13:00) Samoa
3538

36-
## Cause
39+
Consider the following C# example code:
3740

38-
This problem occurs because a change in the base offset of a time zone breaks any code in the affected time zones if that code looks up past dates by using `TimeZoneInfo` in the .NET Framework. This is because the .NET Framework can't track year-to-year changes in the base offset.
41+
```csharp
42+
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Russian Standard Time");
43+
DateTime dt = TimeZoneInfo.ConvertTimeFromUtc(new DateTime(2013, 6, 1), tz);
44+
Console.WriteLine(dt);
45+
```
3946

40-
This problem was exposed by the recent changes to Russian time zones that are described in Microsoft Knowledge Base article 2998527.
47+
Before you apply KB 2998527, this code correctly returns the date and time as June 1, 2013 at 04:00. After you apply the update, the code returns the date and time incorrectly as June 1, 2013 at 03:00.
4148

42-
The .NET Framework previously ignored the UTC offset that is set in an internal adjustment rule. Instead, it used the base UTC offset in certain calculations. The .NET Framework also ignored adjustment rules that don't have daylight transitions.
49+
## Cause
4350

44-
## Status
51+
This problem occurs because a change in the base offset of a time zone breaks any code in the affected time zones if that code looks up past dates by using `TimeZoneInfo` in .NET Framework. This problem occurs because .NET Framework can't track year-to-year changes in the base offset.
4552

46-
Microsoft is researching this problem and will post more information in this article when the information becomes available. A new update is planned that will update the .NET Framework to correctly use UTC offsets and adjustment rules for all-time zones.
53+
This problem was exposed by the changes to Russian time zones that are described in KB 2998527.
4754

48-
We recommend that you install both update 2998527 and the new update when it's available. This will make sure that UTC offset rules are used correctly for all past years and all years going forward.
55+
Previously, .NET Framework ignored the UTC offset that's set in an internal adjustment rule. Instead, it used the base UTC offset in certain calculations. .NET Framework also ignored adjustment rules that don't have daylight transitions.
4956

50-
## More information
57+
## Solution
5158

52-
Consider the following C# example code:
59+
If your .NET application uses `TimeZoneInfo`, update it to use the latest Windows time zone information. If applicable, you should also make sure that your application correctly handles the latest time zone rules for Russia.
5360

54-
```csharp
55-
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("Russian Standard Time");
56-
DateTime dt = TimeZoneInfo.ConvertTimeFromUtc(new DateTime(2013, 6, 1), tz);
57-
Console.WriteLine(dt);
58-
```
61+
## Related content
5962

60-
For example, before you apply KB 2998527, this code correctly returns the date and time as June 1, 2013 at 04:00. After you apply the update, the code incorrectly returns the date and time as June 1, 2013 at 03:00.
63+
- [Time zone changes for Russia in Windows](https://support.microsoft.com/topic/time-zone-changes-for-russia-in-windows-43f3d691-0bab-eb64-3ec1-6451d148194c)
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
---
2-
title: Printing a range of pages fails when you use a WPF application
3-
description: This article discusses a problem in which the process of printing pages fails when you use Windows Presentation Foundation (WPF) application.
4-
ms.date: 03/22/2022
5-
ms.reviewer: hiroakii
2+
title: Printing a Range of Pages Fails When You Use a WPF Application
3+
description: This article discusses a problem in which the process of printing pages fails when you use a Windows Presentation Foundation (WPF) application.
4+
ms.date: 07/08/2025
5+
ms.reviewer: hihayak, davean
66
ms.custom: sap:Class Library Namespaces
7+
ms.topic: troubleshooting-problem-resolution
8+
9+
#customer intent: As a user of a WPF application, I want to work around failures when I print a range of pages so that I can print documents that contain more than 1,000 pages.
710
---
811
# Printing a range of pages fails when you use a WPF application
912

10-
This article discusses a problem in which the process of printing pages fails when you use Windows Presentation Foundation (WPF) application.
13+
This article discusses a problem in which you can't successfully print large documents when you use a Windows Presentation Foundation (WPF) application.
1114

1215
## Symptoms
1316

1417
Consider the following scenario:
1518

16-
1. You're using a Windows Presentation Foundation (WPF) application in Windows 10 to print a range of pages.
17-
1. You're running the `XpsDocument` object to process the print job by using `VisualsToXpsDocument`, `DocumentPaginator`, or another method.
19+
1. You use a WPF application in Windows 10 or later versions to print a range of pages.
20+
1. You run the `XpsDocument` object to process the print job by using `VisualsToXpsDocument`, `DocumentPaginator`, or another method.
1821

19-
In this scenario, the print process fails after printing some pages.
22+
In this scenario, the print process fails after you print some pages.
2023

2124
## Cause
2225

23-
When you print pages by using a WPF application on Windows 10, the font information is allocated on a page-by-page basis. If you're using this method to print a range of pages in a runtime, the process may increase memory usage by the operating system.
26+
When you print pages by using a WPF application in Windows 10 or later, the font information is allocated on a page-by-page basis. If you're using this method to print a range of pages in a runtime, the process may increase memory usage by the operating system.
2427

25-
For example, if you're printing more than 8,000 pages, the process may stop because of a temporary increase in memory usage. This error indicates that an IOException occurred due to a failed access to the font file.
28+
For example, if you're printing more than 8,000 pages, the process may stop because of a temporary increase in memory usage. This error indicates that an `IOException` occurred because of failed access to the font file.
2629

27-
When all of the pages finish printing, memory can be freed for allocation.
30+
After all the pages finish printing, memory can be freed for allocation.
2831

29-
## Workaround
32+
## Solution
3033

31-
For the documents that contain more than 1,000 pages, reduce the number of pages that you process to print job in a runtime.
34+
To resolve this issue apply the [January 2025 Cumulative Update Preview](/dotnet/framework/release-notes/2025/01-28-january-cumulative-update-preview) or a later update for .NET Framework.
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,50 @@
11
---
2-
title: IME can't trigger PreviewKeyDown event of TextBox in WPF apps
3-
description: Describes the issue that some Microsoft IMEs can't trigger PreviewKeyDown event of TextBox control in WPF apps.
4-
ms.date: 02/28/2022
2+
title: IME Can't Trigger PreviewKeyDown Event of TextBox in WPF Apps
3+
description: Discusses an issue that prevents some Microsoft IMEs from triggering PreviewKeyDown events of TextBox controls in WPF apps.
4+
ms.date: 07/08/2025
55
Author: aartig13
66
ms.author: aartigoyle
77
ms.reviewer: hirotoh
88
ms.custom: sap:Class Library Namespaces
9+
ms.topic: troubleshooting-problem-resolution
10+
11+
#customer intent: As a developer, I want to fix an issue that prevents IMEs from triggering PreviewKeyDown events so that TextBoxes in my WPF app function correctly.
912
---
10-
# PreviewKeyDown event of TextBox control can't be triggered by Microsoft IME in WPF apps
13+
# PreviewKeyDown events of TextBox controls aren't triggered by Microsoft IME in WPF apps
1114

1215
> [!NOTE]
13-
> The issue that is described in this article is a bug on Windows 10, version 2004/20H2/21H1/21H2 and it won't be fixed. But it has been fixed on Windows 11. So you can upgrade your system to Windows 11 to avoid the issue.
16+
> The issue that's discussed in this article is a bug in Windows 10, versions 2004, 20H2, 21H1, and 21H2. This bug isn't fixed in Windows 10, but it is fixed in Windows 11. To avoid the issue, you can upgrade your system to Windows 11.
1417
15-
This article discusses an issue that prevents [PreviewKeyDown](/dotnet/api/system.windows.forms.control.previewkeydown) events of TextBox controls from being triggered by some Microsoft input method editors (IMEs) in Windows Presentation Foundation (WPF) applications.
18+
This article discusses an issue that prevents [PreviewKeyDown](/dotnet/api/system.windows.forms.control.previewkeydown) events of TextBox controls from being triggered by some Microsoft input method editors (IMEs) in Windows Presentation Foundation (WPF) applications.
1619

17-
_Applies to:_   Windows Presentation Foundation, Windows 10, version 2004, Windows 10, version 20H2, Windows 10, version 21H1, Windows 10, version 21H2
20+
_Applies to:_ Windows Presentation Foundation, Windows 10, version 2004, Windows 10, version 20H2, Windows 10, version 21H1, Windows 10, version 21H2
1821

1922
## Symptoms
2023

2124
Consider the following scenario:
2225

23-
1. You run a WPF application on Windows 10, version 2004/20H2/21H1/21H2.
24-
1. You input in a TextBox control by using a Microsoft IME of East Asia.
26+
1. You run a WPF application in Windows 10, version 2004, 20H2, 21H1, or 21H2.
27+
1. You enter text into a TextBox control by using a Microsoft IME of East Asia.
2528

2629
In this scenario, the `PreviewKeyDown` event of the control isn't triggered. Therefore, some functions of the application that depend on the `PreviewKeyDown` event handlers don't work as expected.
2730

2831
## Cause
2932

3033
Microsoft IMEs are updated in some versions of Windows 10. This issue occurs when you use some of the latest Microsoft IMEs.
3134

32-
## Workaround
35+
## Solution
3336

3437
Turn on the **Compatibility** option to revert to the previous version of Microsoft IME. To do this, follow these steps:
3538

36-
1. In the search box on the taskbar, enter *language settings*, and then select **Language settings** in the list of results.
39+
1. Select Start, enter *language settings*, and then select **Language settings** in the list of results.
3740

3841
:::image type="content" source="./media/cannot-trigger-event-in-wpf-with-ime/language-settings.png" alt-text="Search language settings in the search box." border="true":::
3942

40-
1. Select **Options** for your language.
43+
1. Select the **Language options** icon (ellipses) for your language.
4144

4245
:::image type="content" source="./media/cannot-trigger-event-in-wpf-with-ime/language-options.png" alt-text="Select language options." border="true":::
4346

44-
1. On the language option settings page, select **Options** for the IME that you're using.
47+
1. On the **Options** page, select **Options** for the IME that you're using.
4548

4649
:::image type="content" source="./media/cannot-trigger-event-in-wpf-with-ime/ime-options.png" alt-text="Select IME options." border="true":::
4750

@@ -51,4 +54,4 @@ Turn on the **Compatibility** option to revert to the previous version of Micros
5154

5255
1. Turn on the **Use previous version of \<YourIME\>** option, and then select **OK** in the window that opens.
5356

54-
:::image type="content" source="./media/cannot-trigger-event-in-wpf-with-ime/turn-on-compatibility.png" alt-text="Turn on the compatibility mode and confirm the IME version change." border="true":::
57+
:::image type="content" source="./media/cannot-trigger-event-in-wpf-with-ime/turn-on-compatibility.png" alt-text="Screenshot that shows how to turn on compatibility mode and verify the IME version change." border="true":::
Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
---
2-
title: COMException when you use WeakReference<T>
2+
title: COMException When You Use WeakReference<T>
33
description: Works around an issue in which a COMException exception occurs when you create a WeakReference<T> object in a .NET Framework-based application.
4-
ms.date: 05/09/2020
4+
ms.date: 07/08/2025
55
ms.reviewer: rachanr, leecow
66
ms.custom: sap:Class Library Namespaces
7+
ms.topic: troubleshooting-problem-resolution
8+
9+
#customer intent: As a developer, I want to resolve COMExceptions that occur when I create a WeakReference object so that my application functions as intended.
710
---
8-
# COMException occurs when you create a WeakReference object in a .NET Framework-based application
11+
# COMException when you create a WeakReference object in a .NET Framework app
12+
13+
This article helps you work around the `COMException` exception that occurs when you create a WeakReference object in a Microsoft .NET Framework-based application.
914

10-
This article helps you work around the `COMException` exception that occurs when you create a WeakReference object in an Microsoft .NET Framework-based application.
15+
_Applies to:_ Microsoft .NET Framework 4.5
1116

12-
_Original product version:_ &nbsp; Microsoft .NET Framework 4.5
13-
_Original KB number:_ &nbsp; 2978463
17+
_Original KB number:_ 2978463
1418

1519
## Symptoms
1620

17-
Assume that you develop a .NET Framework-based application. In this application, you use the reflection API to enumerate methods in a `WeakReference<T>` type. Then you call the `GetFunctionPointer` method on the `RuntimeMethodHandle` handle for the `WeakReference<T>.Create` function. When the pointer to the `WeakReference<T>.Create` method is retrieved by using code that resembles the following code sample:
21+
Assume that you develop a .NET Framework-based application. In this application, you use the reflection API to enumerate methods in a `WeakReference<T>` type. Then, you call the `GetFunctionPointer` method on the `RuntimeMethodHandle` handle for the `WeakReference<T>.Create` function. Code that resembles the following code sample retrieves the pointer to the `WeakReference<T>.Create` method:
1822

1923
```csharp
2024
var assembly = System.Reflection.Assembly.GetAssembly(typeof(WeakReference<object>));
@@ -39,24 +43,26 @@ In this situation, a `COMException` is raised if you create a `WeakReference<T>`
3943
WeakReference<object> wr = new WeakReference<object>(new object());
4044
```
4145

42-
If a debugger is attached to this application's process, you receive an exception and call stack that resembles the following code sample:
43-
44-
> Exception object: 0000000102b7bde8
45-
> Exception type: System.Runtime.InteropServices.COMException
46-
> Message: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
47-
> InnerException: \<none>
48-
> StackTrace (generated):
49-
> \<none>
50-
> StackTraceString: \<none>
51-
> HResult: 80004005
52-
>
53-
> 00 0081eb80 742d5ddf KERNELBASE!RaiseException+0x48
54-
> 01 0081ec20 743eff3f clr!RaiseTheExceptionInternalOnly+0x27f
55-
> 02 0081ec50 7445a27f clr!UnwindAndContinueRethrowHelperAfterCatch+0x90
56-
> 03 0081ecb4 74132b0c clr!PreStubWorker+0x162
57-
> 04 0081ece4 73a0fd37 clr!ThePreStub+0x16
58-
> 05 0081ed08 0483039f mscorlib_ni!System.WeakReference1[[System.__Canon, mscorlib]]..ctor(System.__Canon)+0x7
59-
60-
## Workaround
61-
62-
To work around this issue, don't retrieve a pointer to the `WeakReference<T>.Create` method. This method is private to the `WeakReference<T>` class. So, invoking this method may cause undefined behavior even if you get a pointer to the function.
46+
If a debugger is attached to the application process, you receive an exception and call stack that resemble the following code sample:
47+
48+
```console
49+
Exception object: 0000000102b7bde8
50+
Exception type: System.Runtime.InteropServices.COMException
51+
Message: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
52+
InnerException: \<none>
53+
StackTrace (generated):
54+
\<none>
55+
StackTraceString: \<none>
56+
HResult: 80004005
57+
58+
00 0081eb80 742d5ddf KERNELBASE!RaiseException+0x48
59+
01 0081ec20 743eff3f clr!RaiseTheExceptionInternalOnly+0x27f
60+
02 0081ec50 7445a27f clr!UnwindAndContinueRethrowHelperAfterCatch+0x90
61+
03 0081ecb4 74132b0c clr!PreStubWorker+0x162
62+
04 0081ece4 73a0fd37 clr!ThePreStub+0x16
63+
05 0081ed08 0483039f mscorlib_ni!System.WeakReference1[[System.__Canon, mscorlib]]..ctor(System.__Canon)+0x7
64+
```
65+
66+
## Solution
67+
68+
To work around this issue, don't retrieve a pointer to the `WeakReference<T>.Create` method. This is a private method of the `WeakReference<T>` class. Therefore, invoking this method might cause undefined behavior even if you get a pointer to the function.

0 commit comments

Comments
 (0)