Skip to content

WPF Fluent stopped working after I updated Visual Studio (and .NET SDK) #9637

@TonyHenrique

Description

@TonyHenrique

Description

I was using a recent feature of WPF that is this Fluent Resource, using this:

<ResourceDictionary Source="pack://application:,,,/PresentationFramework.Fluent;component/Resources/Fluent.xaml" />

But after I updated Visual Studio, this resource is not being found and a new build of the App is not running anymore.

Reproduction Steps

Create a new WPF Application, and use the resource dictionary like this example:

<Application x:Class="SubtitlesToSpeech.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:SubtitlesToSpeech"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/PresentationFramework.Fluent;component/Resources/Fluent.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

Expected behavior

The App runs with the fluent, with the provided code. (Perhaps something changed and I am not aware?)

Actual behavior

It is giving this exception when I run the app, (that was working before I update the VS and .NET SDK)

System.Windows.Markup.XamlParseException: ''Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '9' and line position '18'.'


Inner Exception
IOException: Cannot locate resource 'resources/fluent.xaml'.

This exception was originally thrown at this call stack:
    MS.Internal.AppModel.ResourcePart.GetStreamCore(System.IO.FileMode, System.IO.FileAccess)
    System.IO.Packaging.PackagePart.GetStream(System.IO.FileMode, System.IO.FileAccess)
    MS.Internal.IO.Packaging.PackagePartExtensions.GetSeekableStream(System.IO.Packaging.PackagePart, System.IO.FileMode, System.IO.FileAccess)
    System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream()
    System.IO.Packaging.PackWebResponse.ContentType.get()
    MS.Internal.WpfWebRequestHelper.GetContentType(System.Net.WebResponse)
    MS.Internal.WpfWebRequestHelper.GetResponseStream(System.Net.WebRequest, out MS.Internal.ContentType)
    System.Windows.ResourceDictionary.Source.set(System.Uri)
    MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(object, System.Xaml.XamlMember, object)


Regression?

It was working on previous preview.
After I updated visual studio to Version 17.12.0 Preview 1.0 , dotnet SDK 9.0.100-preview.7.24407.12
It stopped working.

Known Workarounds

No response

Impact

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions