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

Adding System.Reactive to WinUI3/MAUI app increases package size by 44MB because it includes WPF and WinForms references #1745

Open
DeanFaizal opened this issue Apr 19, 2022 · 2 comments · May be fixed by #2084

Comments

@DeanFaizal
Copy link

Bug

Which library version?
System.Reactive 5.0.0

What are the platform(s), environment(s) and related component version(s)?
WinUI3, MAUI

What is the use case or problem?
Using System.Reactive in WinUI3 app

What is the expected outcome?
Only required references for the platform are included in app package

What is the actual outcome?
The app package increases from 44MB to 88MB with the following additional dlls in the package:

"Accessibility.dll"
"D3DCompiler_47_cor3.dll"
"DirectWriteForwarder.dll"
"Microsoft.VisualBasic.Forms.dll"
"Microsoft.Win32.Registry.AccessControl.dll"
"Microsoft.Win32.SystemEvents.dll"
"PenImc_cor3.dll"
"PresentationCore.dll"
"PresentationFramework.Aero.dll"
"PresentationFramework.Aero2.dll"
"PresentationFramework.AeroLite.dll"
"PresentationFramework.Classic.dll"
"PresentationFramework.dll"
"PresentationFramework.Luna.dll"
"PresentationFramework.Royale.dll"
"PresentationFramework-SystemCore.dll"
"PresentationFramework-SystemData.dll"
"PresentationFramework-SystemDrawing.dll"
"PresentationFramework-SystemXml.dll"
"PresentationFramework-SystemXmlLinq.dll"
"PresentationNative_cor3.dll"
"PresentationUI.dll"
"ReachFramework.dll"
"System.CodeDom.dll"
"System.Configuration.ConfigurationManager.dll"
"System.Design.dll"
"System.Diagnostics.EventLog.dll"
"System.Diagnostics.PerformanceCounter.dll"
"System.DirectoryServices.dll"
"System.Drawing.Common.dll"
"System.Drawing.Design.dll"
"System.IO.Packaging.dll"
"System.Printing.dll"
"System.Reactive.dll"
"System.Resources.Extensions.dll"
"System.Security.Cryptography.Pkcs.dll"
"System.Security.Cryptography.ProtectedData.dll"
"System.Security.Cryptography.Xml.dll"
"System.Security.Permissions.dll"
"System.Threading.AccessControl.dll"
"System.Windows.Controls.Ribbon.dll"
"System.Windows.Extensions.dll"
"System.Windows.Forms.Design.dll"
"System.Windows.Forms.Design.Editors.dll"
"System.Windows.Forms.dll"
"System.Windows.Forms.Primitives.dll"
"System.Windows.Input.Manipulations.dll"
"System.Windows.Presentation.dll"
"System.Xaml.dll"
"UIAutomationClient.dll"
"UIAutomationClientSideProviders.dll"
"UIAutomationProvider.dll"
"UIAutomationTypes.dll"
"vcruntime140_cor3.dll"
"WindowsFormsIntegration.dll"
"wpfgfx_cor3.dll"

These seem to be localization folders:
"cs"
"de"
"es"
"fr"
"it"
"ja"
"ko"
"pl"
"pt-BR"
"ru"
"tr"
"zh-Hans"
"zh-Hant"

Inside each localization folder:
"System.Windows.Input.Manipulations.resources.dll"
"System.Xaml.resources.dll"
"UIAutomationClient.resources.dll"
"UIAutomationClientSideProviders.resources.dll"
"UIAutomationProvider.resources.dll"
"UIAutomationTypes.resources.dll"
"WindowsBase.resources.dll"
"WindowsFormsIntegration.resources.dll"
"Microsoft.VisualBasic.Forms.resources.dll"
"PresentationCore.resources.dll"
"PresentationFramework.resources.dll"
"PresentationUI.resources.dll"
"ReachFramework.resources.dll"
"System.Windows.Controls.Ribbon.resources.dll"
"System.Windows.Forms.Design.resources.dll"
"System.Windows.Forms.Primitives.resources.dll"
"System.Windows.Forms.resources.dll"

What is the stacktrace of the exception(s) if any?
N/A

Do you have a code snippet or project that reproduces the problem?

  1. Create a File > New MAUI app
  2. Update OnCounterClicked
    private void OnCounterClicked(object sender, EventArgs e)
    {
        var source = Observable.Timer(DateTimeOffset.MinValue, TimeSpan.FromSeconds(1)).Timestamp();
        source.Subscribe(x =>
        Application.Current.Dispatcher.Dispatch(() =>
        {
            CounterLabel.Text = x.Timestamp.ToString();
        }));
        SemanticScreenReader.Announce(CounterLabel.Text);
    }
  1. Add System.Reactive nuget or the following in csproj:
	<ItemGroup>
	  <PackageReference Include="System.Reactive" Version="5.0.0" />
	</ItemGroup>
  1. Build the app in command prompt
msbuild MauiReactive.sln -restore -p:Configuration=Release
  1. Package the app in command prompt
"C:\Program Files (x86)\Windows Kits\10\App Certification Kit\MakeAppx" pack /v /h SHA256 /d "MauiReactive\bin\Release\net6.0-windows10.0.19041\win10-x64" /p MauiReactive.msix
@DeanFaizal
Copy link
Author

@idg10
Copy link
Collaborator

idg10 commented Feb 5, 2024

As a workaround, does adding this to the csproj for your main application resolve the problem?

  <PropertyGroup>
    <DisableTransitiveFrameworkReferences>true</DisableTransitiveFrameworkReferences>
    <UseWindowsForms>true</UseWindowsForms>
    <UseWPF>false</UseWPF>
  </PropertyGroup>

@idg10 idg10 linked a pull request Feb 12, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants