Closed dotMorten closed 5 months ago
Had a similar error today building an Xamarin Forms UWP app with VS 17.3.4 I think. Updating to 17.3.5 fixed, but it seemed random.
2022-09-29T17:23:41.5430851Z ##[error]C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.AppXPackage.Targets(1718,5): Error MSB4018: The "ExpandPriContent" task failed unexpectedly.
System.Xml.XmlException: Root element is missing.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at Microsoft.Build.Packaging.Pri.Tasks.ExpandPriContent.ExecuteImplementation()
at Microsoft.Build.AppxPackage.AppxPackagingToolTaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
@rohanp-msft is there a known workaround for this without having to restart the VS? Is there anything we could help with to resolve this issue? Happens quite frequently when there is a change in xaml files.
@LadderLogic AFAIK, there isn't another workaround (rebuilding the solution might be one, though that's just as bad). This was postponed due to some higher priority work. I will be able to look at this in a week's time. We apologize for the delay.
@LadderLogic Hi Nanda, do you have a repro of this?
Had a similar error today building an Xamarin Forms UWP app with VS 17.3.4 I think. Updating to 17.3.5 fixed, but it seemed random.
2022-09-29T17:23:41.5430851Z ##[error]C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.AppXPackage.Targets(1718,5): Error MSB4018: The "ExpandPriContent" task failed unexpectedly. System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options) at Microsoft.Build.Packaging.Pri.Tasks.ExpandPriContent.ExecuteImplementation() at Microsoft.Build.AppxPackage.AppxPackagingToolTaskBase.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
This is unrelated other than this exception also occurs in the same task. Somehow, the PRI XML dump was invalid here. Anyway, it looks like the problem is gone for you after the upgrade.
@LadderLogic Hi Nanda, do you have a repro of this?
@rohanp-msft, it's part of a large solution with multiple projects referencing the same xaml control library, but I'll try to make a small repo soon.
Since there haven't been any recent reports of this issue, we expect this is addressed by an update to VS. I am closing this issue. If it is reported again on latest VS, etc., we will revisit it.
Yes, it is still happening in Visual Studio 2022 17.5.0 and WindowsAppsSDK 1.2.221109.1.
Changing Assignee per ownership change. Will let Robert @robertzhou-wpn follow-up as needed.
hello, i got the same error currently.
Projekt is a Xamarin Forms projekt, when Building the UWP Projekt i get the error.
visual studio community 17.5.1
Name Microsoft.WindowsAppRuntime.1.1 Version : 1005.616.1651.0
No WindowsAppSDK version installed.
Betriebsystemname Microsoft Windows 11 Pro Version 10.0.22621 Build 22621 Systemtyp x64-basierter PC
Error:
ITNOA
@rohanp-msft please reopen this issue
I do not think this issue is resolved
ITNOA
@rohanp-msft please reopen this issue
I do not think this issue is resolved
@soroshsabz The owners have changed (see the current Assignees of this issue). I notified them when you commented. @loneursid can provide the triage results.
FYI - this seems to have helped others with the System.ObjectDisposedException:
for VS builds:
>set MSBUILDDISABLENODEREUSE=1
for MSBuilds: (above) or
>msbuild /nodeReuse:false ...
Same here! Solutions?
We have root caused this issue to a bug in the MSIX packaging support logic in Windows App SDK and will have a fix available soon. There is no workaround.
I see the issue once in a while when building Windows Runtime Components which are C++ WinUI3 Desktop type components. I am using the latest everything VS2022 17.96, Latest Windows App SDK etc. When it happens it is after working for a while and normally a clean rebuild works to resolve but more recently that is failing. This is starting to become a productivity issue.
2>AccessServerWRC.vcxproj -> C:\Users\tim\Source\Repos\PDFAlign\x64\Debug\AccessServerWRC\AccessServerWRC.dll
2>C:\Users\tim\Source\Repos\Packages_nuget\Microsoft.WindowsAppSDK.1.5.240404000\build\MrtCore.PriGen.targets(913,5): error MSB4018: The "ExpandPriContent" task failed unexpectedly.
2>C:\Users\tim\Source\Repos\Packages_nuget\Microsoft.WindowsAppSDK.1.5.240404000\build\MrtCore.PriGen.targets(913,5): error MSB4018: System.ObjectDisposedException: Cannot access a disposed object.
2>C:\Users\tim\Source\Repos\Packages_nuget\Microsoft.WindowsAppSDK.1.5.240404000\build\MrtCore.PriGen.targets(913,5): error MSB4018: Object name: 'it is not allowed to use disposed Microsoft.VisualStudio.Telemetry.TelemetrySession object.'.
2>C:\Users\tim\Source\Repos\Packages_nuget\Microsoft.WindowsAppSDK.1.5.240404000\build\MrtCore.PriGen.targets(913,5): error MSB4018: at Microsoft.VisualStudio.Telemetry.TelemetryDisposableObject.RequiresNotDisposed()
2>C:\Users\tim\Source\Repos\Packages_nuget\Microsoft.WindowsAppSDK.1.5.240404000\build\MrtCore.PriGen.targets(913,5): error MSB4018: at Microsoft.VisualStudio.Telemetry.TelemetrySession.SerializeSettings()
2>C:\Users\tim\Source\Repos\Packages_nuget\Microsoft.WindowsAppSDK.1.5.240404000\build\MrtCore.PriGen.targets(913,5): error MSB4018: at Microsoft.Build.AppxPackage.Telemetry.Get(IBuildEngine4 buildEngine, String vsTelemetrySession)
2>C:\Users\tim\Source\Repos\Packages_nuget\Microsoft.WindowsAppSDK.1.5.240404000\build\MrtCore.PriGen.targets(913,5): error MSB4018: at Microsoft.Build.AppxPackage.AppxPackagingTaskHelper..ctor(IBuildEngine4 buildEngine, TaskLoggingHelper logger, Action execute, Func2 exceptionHandler, Action cleanup, Func
1 manifestFileNameGetter, String vsTelemetrySession)
2>C:\Users\tim\Source\Repos\Packages_nuget\Microsoft.WindowsAppSDK.1.5.240404000\build\MrtCore.PriGen.targets(913,5): error MSB4018: at Microsoft.Build.AppxPackage.AppxPackagingToolTaskBase.Execute()
2>C:\Users\tim\Source\Repos\Packages_nuget\Microsoft.WindowsAppSDK.1.5.240404000\build\MrtCore.PriGen.targets(913,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
2>C:\Users\tim\Source\Repos\Packages_nuget\Microsoft.WindowsAppSDK.1.5.240404000\build\MrtCore.PriGen.targets(913,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.
I have a suspicion that files might get left open which also may be why Clean fails once in a while. Which also may be why closing VS and opening again solves the issue.
Here's an explanation of the fix (thanks, @evelynwu-msft), which will be available in WinAppSDK 1.6:
The Single-project MSIX Packaging build tasks were, by default, directly using VS's default telemetry session. After they finished running, they would dispose this default session. Later, if some other build task in the same MSBuild process accessed the now-disposed default session, an exception would be raised.
Describe the bug
I'm often experiencing the following bug when compiling. Usually it works, but once hitting this, I have to restart Visual Studio. Looks to be a failure in the telemetry code, preventing me from compiling. I don't have a consistent repro, but have observed it with both v1.0.0 and v1.1.4:
Steps to reproduce the bug
No specific repro. Happens after building a maui app over and over. I've observed it on two different PCs, one running Win10 and the other Win11. VS version was 17.3.1 on both.
Expected behavior
No response
Screenshots
No response
NuGet package version
1.1.4
Packaging type
Packaged (MSIX)
Windows version
Windows 11 version 21H2 (22000)
IDE
Visual Studio 2022
Additional context
Visual Studio 17.3.1. Looks very similar to Xamarin telemetry issue (that was supposed to be fixed in 17.3.1 but I'm still occasionally observing that one too). See https://developercommunity.visualstudio.com/t/Unexpecter-error-of-task-Xamarin-Teleme/10096527