Skip to content

fix: Trimming of CommunicationToast constructor when publishing #4068

@PascalVorwerk

Description

@PascalVorwerk

🐛 Bug Report

Locally when running in debug or production mode, using the CommunicationToast is working completely fine, however after deploying to our IIS machine it does not work anymore. It looks like the constructor is being trimmed from the assembly. We have for now disabled trimming which resolved the issue, but ideally we would love to have it on. Tried several approaches to workaround but each was giving other errors.

Pre workaround:
Image

With a workaround (dummy CommunicationToast in own assembly):

Image

💻 Repro or Code Sample

I'm finding it hard to reproduce, publishing locally does not seem to have the same error, but I am working on a MAC compared to the IIS windows deployment. Maybe that could be the culprit between the 2?

The code looks something like this:

@page "/"
@using Microsoft.FluentUI.AspNetCore.Components
@inject IToastService ToastService

<PageTitle>Home</PageTitle>

@if (RendererInfo.IsInteractive)
{
    <FluentButton OnClick="ShowCommunicationToast">Show toast</FluentButton>
    <FluentToastProvider/>
}

@code {
    private void ShowCommunicationToast()
    {
        ToastService.ShowCommunicationToast(new ToastParameters<CommunicationToastContent>()
        {
            Intent = ToastIntent.Error,
            Title = "Title",
            TopCTAType = ToastTopCTAType.Timestamp,
            Timeout = 8000,
            Content = new CommunicationToastContent()
            {
                Subtitle = "Sub title",
                Details = "Some details about the toast",
            },
        });
    }
}

🌍 Your Environment

  • OS & Device: Windows
  • Browser Tried both Chrome and Safari, both not working
  • .NET 9.0.8 and Fluent UI 4.12.1

It is worth noting that we are providing the Fluent UI packages to our projects through our own (internal) packages, could it possibly have anything to do with that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions