On the released version of Net Core 3 found new issue with PublishSingleFile, it has to do with User Settings. I have attached a small project syncfusionwpfapp4.zip
SyncfusionWpfApp4.zip
that you can reproduce the issue. The issue. In the projects MainWindow.xaml.cs file you will find a remarked out public UserAppSettings mySettings = new UserAppSettings(); This if unremarked Initializes the the UserSettings class. Without this the project builds and works, it publishes and works even as a PublishShingleFile, but with this unremarked and the UserSettings class used it will return the following eventlog error. So how in Net Core 3 can you use user settings that can be changed in a WPF application. Again it works fine from the win-64 folder and only breaks in the PublishSingleFile mode if the UserSettings.cs is used. I search for answers but did not find one. This is a sample small project using the broken parts of the production xml editor that run under .Net 4.7.2. in an attempt to migrate to Net Core 3.
Note: It states System.dll is missing and that is not true for win-x64 folder but is true for the publish extracted folder after attempting to run SingleExe with User Settings Class enabled.
[Application: SyncfusionWpfApp4.exe
CoreCLR Version: 4.700.19.46205
.NET Core Version: 3.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Windows.Markup.XamlParseException: The invocation of the constructor on type 'SyncfusionWpfApp4.MainWindow' that matches the specified binding constraints threw an exception.
---> System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for applicationSettings/SyncfusionWpfApp4.Properties.Settings: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified. (C:\Users\DANNY~1.MCN\AppData\Local\Temp.net\SyncfusionWpfApp4\aegml1hv.syu\SyncfusionWpfApp4.dll.config line 8)
---> System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
File name: 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
at System.Configuration.TypeUtil.GetType(IInternalConfigHost host, String typeString, Boolean throwOnError)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
--- End of inner exception stack trace ---
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ClientSettingsStore.ReadSettings(String sectionName, Boolean isUserScoped)
at System.Configuration.LocalFileSettingsProvider.GetPropertyValues(SettingsContext context, SettingsPropertyCollection properties)
at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider)
at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
at System.Configuration.SettingsBase.get_Item(String propertyName)
at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)
at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)
at SyncfusionWpfApp4.Properties.Settings.get_ToDecimalStringFormat()
at SyncfusionWpfApp4.UserAppSettings..ctor()
at SyncfusionWpfApp4.MainWindow..ctor()
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__1_0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at SyncfusionWpfApp4.App.Main()](url)
Just updated to 16.3.3 this morning and still does not work:
Microsoft Visual Studio Enterprise 2019
Version 16.3.3
VisualStudio.16.Release/16.3.3+29403.142
Microsoft .NET Framework
Version 4.8.03761
Installed Version: Enterprise
Visual C++ 2019 00433-90100-63537-AA870
Microsoft Visual C++ 2019
.NET Portability Analyzer 1.1.10808.0
Evaluates portability of assemblies across .NET platforms.
Add New File 3.5.134
The fastest and easiest way to add new files to any project - including files that start with a dot
ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools
ASP.NET and Web Tools 2019 16.3.284.37798
ASP.NET and Web Tools 2019
ASP.NET Core Blazor Language Services 16.0.19307.2
ASP.NET Web Frameworks and Tools 2019 16.3.284.37798
For additional information, visit https://www.asp.net/
Atomineer Pro Documentation 1.0
Source-code documentation-comment creation and maintenance, and other documentation-related tools.
Automatic Versions 2.0.48
Provides tools for managing assembly versions.
Azure App Service Tools v3.0.0 16.3.284.37798
Azure App Service Tools v3.0.0
Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.
Azure Data Lake Tools for Visual Studio 2.4.1000.0
Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools 16.3.284.37798
Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio 2.4.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio
C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
CodeRush for Roslyn 19.1.9.0
DevExpress CodeRush for Roslyn package.
CodeRush for Roslyn Tool Windows 19.1.9.0
DevExpress CodeRush for Roslyn Tool Windows package.
Comment Remover 1.3.25
Remove all comments in any file with a click of a button. Can also remove #regions and preserve XML Doc comments.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
ConvertAppToCore3Command Extension 1.0
ConvertAppToCore3Command Visual Studio Extension Detailed Info
Cookiecutter 16.3.19252.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.
Dotfuscator Community Edition 5.42.0.9514-e0e25f754
PreEmptive Protection - Dotfuscator CE
Extensibility Message Bus 1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events
GhostDoc 19.2.19200.0
Generate XML Comments from your code, maintain clean and up-to-date documentation, produce help documentation in multiple formats, use intelligent source code Spell Checker in Visual Studio.
GitHub.VisualStudio 2.10.7.8114
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.
IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info
Microsoft Azure HDInsight Azure Node 2.4.1000.0
HDInsight Node under Azure Node
Microsoft Azure Hive Query Language Service 2.4.1000.0
Language service for Hive query
Microsoft Azure Service Fabric Tools for Visual Studio 16.0
Microsoft Azure Service Fabric Tools for Visual Studio
Microsoft Azure Stream Analytics Language Service 2.4.1000.0
Language service for Azure Stream Analytics
Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.20816.1
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 2.0.83+gbc8a4b23ec
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
Mono Debugging for Visual Studio 16.3.7 (9d260c5)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 5.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Office Developer Tools for Visual Studio 16.0.29217.00
Microsoft Office Developer Tools for Visual Studio
Open in Visual Studio Code 1.4.46
Adds a menu command that lets you open any solution, project, folder and file in Visual Studio Code.
OzCodePackage Extension 1.0
OzCodePackage Visual Studio Extension Detailed Info
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Python 16.3.19252.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Python - Conda support 16.3.19252.1
Conda support for Python projects.
Python - Django support 16.3.19252.1
Provides templates and integration for the Django web framework.
Python - IronPython support 16.3.19252.1
Provides templates and integration for IronPython-based projects.
Python - Profiling support 16.3.19252.1
Profiling support for Python projects.
SlowCheetah - XML config transforms 1.0
This package enables you to transform your app.config or any other XML file based on the build configuration. It also adds additional tooling to help you create XML transforms.
Snapshot Debugging Extension 1.0
Snapshot Debugging Visual Studio Extension Detailed Info
Snippet Designer 1.6.5
Snippet Designer is a Visual Studio plug in which allows you to create and search for snippets inside the IDE
SQL Server Data Tools 16.0.61908.27190
Microsoft SQL Server Data Tools
Syncfusion ASP.NET Core (Essential JS 1) Project Templates 17.3.0.14
Provides project templates for creating an ASP.NET Core Web Application using Syncfusion Essential JS 1 components.
Syncfusion ASP.NET Core (Essential JS 2) Project Templates 17.3.0.14
Provides project templates for creating an ASP.NET Core Web Application using Syncfusion Essential JS 2 components.
Syncfusion ASP.NET MVC (Essential JS 2) Project Templates 17.1.0.32
Provides project templates for creating ASP.NET MVC (Essential JS 2) Web Applications using Syncfusion components.
Syncfusion EJ2 Web Conversion and Migration 13.4.0.53
Converts and migrates a web project into a Syncfusion web project.
Syncfusion Reference Manager 17.3.0.14
A useful add-in for adding and migrating Syncfusion Assembly References for Windows Forms, WPF, and Silverlight projects.
Syncfusion UWP Project Templates 17.3.0.14
Project to create an Universal Windows Application using Syncfusion Products.
Syncfusion WPF Project Templates 17.3.0.14
Provides Project Templates to add Syncfusion WPF Project along with corresponding configurations.
Syncfusion.VSExtension.Troubleshooter 17.3.0.14
Add-in for Troubleshooting the Syncfusion projects.
Syncfusion.WindowsForms.Package 17.3.0.14
Provides Item/Project Templates to add Syncfusion Windows Forms Item/Project along with corresponding configurations.
SyncfusionMenu Extension 1.0
SyncfusionMenu Visual Studio Extension Detailed Info
Syntax Visualizer 1.0
An extension for visualizing Roslyn SyntaxTrees.
Tabs Studio 4.5.0
The document tabs manager.
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript Tools 16.0.10821.2002
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823
Microsoft Visual F# Tools 10.4 for F# 4.6
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Color Theme Editor 1.0
Allows users to create and edit Visual Studio themes. Themes can customize colors used for menus, toolbars, tabs, titlebars, the text editor, and other environment colors.
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
Visual Studio Tools for Kubernetes 1.0
Visual Studio Tools for Kubernetes
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Windows Template Studio 3.4.19254.1
Windows Template Studio quickly builds a UWP app, using a wizard-based UI to turn your needs into a foundation of Windows 10 patterns and best practices.
Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.
Xamarin 16.3.0.275 (d16-3@35ef585)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.3.0.246 (remotes/origin/d16-3@bd2f86892)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.3.565 (27e9746)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 10.0.3.0 (d16-3/4d45b41)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono/2019-06@5608fe0abb3
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip/rel-1-5-1@b95cf3fd
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333
Xamarin.iOS and Xamarin.Mac SDK 13.2.0.47 (c2cbd34)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Have you tried this without PublishTrimmed? If not, would you mind giving that a try?
Installing 16.3.4 now once done will try.
@vatsan-madhavan That works without PublishTrimmed. Of course the published file is a lot bigger. Is this plans to fix this?
Setting PublishTrimmed to false in my production migration test application also works.
Unfortunately, there may be nothing to be _fixed_.
Please see https://github.com/mono/linker/blob/master/src/ILLink.Tasks/README.md which describes some of the pitfalls of using PublishTrimmed with WPF (and ASP.NET Core). I think you might have to experiment with _reflection roots_ to get things working for your application.
@vatsan-madhavan Thanks based on you link. I added the following to my project file and it now works with the PublishTrimmed set to true.
TrimmerRootAssembly Include="System"
Good to hear @SFC-Sarge!
@vatsan-madhavan thanks, just so you know in my production migration I had to add more to get PublishedTrimmed to work:
I think this is at least partly due to extension assemblies hiding the dependencies.
True. I have a System.Xml.Linq.Extensions class.
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: Rob LaDuca notifications@github.com
Sent: Thursday, October 10, 2019 3:49:51 PM
To: dotnet/wpf wpf@noreply.github.com
Cc: Danny McNaught sfcsarge@outlook.com; Mention mention@noreply.github.com
Subject: Re: [dotnet/wpf] Net Core 3 Publish SingleExe and User Settings Does not work (#2034)
I think this is at least partly due to extension assemblies hiding the dependencies.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdotnet%2Fwpf%2Fissues%2F2034%3Femail_source%3Dnotifications%26email_token%3DAJVQO5OP37UQFTLVTLR4BETQN6BN7A5CNFSM4I7PIWPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEA5UJRY%23issuecomment-540755143&data=02%7C01%7C%7C12fe9020b270422a9bc408d74dbb047b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637063337933011715&sdata=6LMpljC5UCOANrKYGikSxEsiof61TVwOtCoBjMuoNVo%3D&reserved=0, or unsubscribehttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJVQO5PU65BDM4FK5APMR5LQN6BN7ANCNFSM4I7PIWPA&data=02%7C01%7C%7C12fe9020b270422a9bc408d74dbb047b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637063337933021731&sdata=p5%2FL46ZmcI9cKTRF1Ebn0vELeVaSmz7NkrJ93sBxITQ%3D&reserved=0.