Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet-sdk-10.0.100-alpha.1.25057.15] System.Windows.Threading.Dispatcher cannot find type "MS.Internal.SecurityCriticalDataClass`1" in PresentationThemeAero #10256

Open
Junjun-zhao opened this issue Jan 10, 2025 · 8 comments
Labels
📭 waiting-author-feedback To request more information from author.

Comments

@Junjun-zhao
Copy link
Member

Junjun-zhao commented Jan 10, 2025

Description

When run the 3rd party application with the latest .NET 10 build, it failed with custom error: "ThemeManager is not operational.". We found that this is due to System.Windows.Threading.Dispatcher cannot find type "MS.Internal.SecurityCriticalDataClass`1".

Reproduction Steps

App Repro Steps:
1.Copy DotNetCore/AppSource/SourceShare/PresentationThemeAero to your local machine .
2.Open "PresentationThemeAero\App\PresentationThemeAero\ThemeBrowser.runtimeconfig.json" file .
3.Change the "ThemeBrowser.runtimeconfig.json" file to let the app run against with
dotnet-sdk-10.0.100-alpha.1.25057.15.

"framework": {
      "name": "Microsoft.WindowsDesktop.App",
      "version": "10.0.0-alpha.1.25056.2"
    }
  1. Run the ”PresentationThemeAero\App\PresentationThemeAero\ThemeBrowser.exe”.

Expected Result:
Launch successfully.

Actual Result:
Launch failed with error: "ThemeManager is not operational."

Minimal Repro steps (Demo attached: WpfDemo.zip):

  1. Create a default 9.0 WPF project.
  2. Add the following code in Mainwindow.xaml.cs.
using System.Windows;
using System.Windows.Threading;
namespace WpfDemo
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            var WindowsBase = typeof(Dispatcher).Assembly;
            if (WindowsBase.GetType("MS.Internal.SecurityCriticalDataClass`1") == null)
            {
                throw new InvalidOperationException(
                    "Test is not operational.");
            }
        }
    }
}
  1. Build the project.
  2. Change the runtime.config file to let the app run against with dotnet-sdk-10.0.100-alpha.1.25057.15:
"frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "10.0.0-alpha.1.25052.4"
      },
      {
        "name": "Microsoft.WindowsDesktop.App",
        "version": "10.0.0-alpha.1.25056.2"
      }
    ],
  1. Launch the app.

Expected behavior

Launch successfully.

Actual behavior

Throw custom error: "Test is not operational., because WindowsBase.GetType("MS.Internal.SecurityCriticalDataClass`1") is null.

Regression?

Yes

Verify Scenarios:
1). Windows 10 22H2 AMD64 + dotnet-sdk-9.0.102: Pass
2). Windows 10 22H2 AMD64 + dotnet-sdk-10.0.100-alpha.1.25057.15: Fail

Known Workarounds

No response

Impact

No response

Configuration

Application Name: PresentationThemeAero
OS: Windows 10 22H2
CPU: X64
.NET Build Number: dotnet-sdk-10.0.100-alpha.1.25057.15
App & Source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2335115
Github Link: https://github.com/gix/PresentationTheme.Aero

Dotnet info:

.NET SDK:
 Version:           10.0.100-alpha.1.25057.15
 Commit:            39da6dde11
 Workload version:  10.0.100-manifests.a166a9cf
 MSBuild version:   17.14.0-preview-25056-07+8d395fd27

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\10.0.100-alpha.1.25057.15\

Host:
  Version:      10.0.0-alpha.1.25052.4
  Architecture: x64
  Commit:       efdd299533

.NET SDKs installed:
  10.0.100-alpha.1.25057.15 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 10.0.0-alpha.2.25056.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 10.0.0-alpha.1.25052.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 10.0.0-alpha.1.25056.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other information

@dotnet-actwx-bot @dotnet/compat

@miloush
Copy link
Contributor

miloush commented Jan 10, 2025

Internal types are an implementation detail and subject to change without notice. Is the original application trying to use an internal type?

@h3xds1nz
Copy link
Contributor

@miloush
Copy link
Contributor

miloush commented Jan 10, 2025

Right. Well then yeah sorry, unless they have a strong business case, that app will not be compatible with .NET 10.

@Junjun-zhao Junjun-zhao changed the title [dotnet-sdk-10.0.100-alpha.1.25057.15] System.Windows.Threading.Dispatcher cannot find type "MS.Internal.SecurityCriticalDataClass`1" [dotnet-sdk-10.0.100-alpha.1.25057.15] System.Windows.Threading.Dispatcher cannot find type "MS.Internal.SecurityCriticalDataClass`1" in PresentationThemeAero Jan 10, 2025
@MichaeIDietrich
Copy link
Contributor

Should we consider to officially obsolete all old WPF themes onward and give only support for Fluent, Aero2, Generic and maybe Classic?

@miloush
Copy link
Contributor

miloush commented Jan 11, 2025

@MichaeIDietrich you probably should open a new issue/discussion for that. It's not like we needed to fix anything in the other themes in the past decade, so not sure what the gain would be.

@Junjun-zhao
Copy link
Member Author

Right. Well then yeah sorry, unless they have a strong business case, that app will not be compatible with .NET 10.

Ok. We will file an issue for this application to let the owner know.

@gix
Copy link

gix commented Jan 13, 2025

Right. Well then yeah sorry, unless they have a strong business case, that app will not be compatible with .NET 10.

The use case is to use a different theme as drop-in replacement (to get proper looking Windows 8-10 themes, not the lackluster theme shipped out of the box) which is impossible to do without hacking it in. I've filed #110 over 6 years ago.

(Not arguing for this bug. I know reflection is brittle and on me to fix.)

@miloush
Copy link
Contributor

miloush commented Jan 13, 2025

@gix I understand the scenario and I am sure you can make it continue to work after you account for the changes in the internal code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📭 waiting-author-feedback To request more information from author.
Projects
None yet
Development

No branches or pull requests

6 participants