Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?
If you are experiencing any issues with your desktop wallpaper or taskbar buttons
please download and install the latest DisplayFusion beta version before contacting support.

User Image
Mikołaj Chyczyński
1 discussion post
Hi,

I'm experiencing a C# scripted function compilation issue in DisplayFusion 12.1.1, related to System.Drawing.Graphics, TextRenderer, and a missing System.Private.Windows.GdiPlus assembly reference.

The same code worked in DisplayFusion 12.0.2 but fails to compile in 12.1.1 after the migration to .NET 10.

Minimal Reproduction:

Create a new C# scripted function and paste the following code:

Code

using System;
using System.Drawing;
using System.Windows.Forms;

public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
    }

    private static void Test(PaintEventArgs e)
    {
        TextRenderer.DrawText(
            e.Graphics,
            "Test",
            SystemFonts.DefaultFont,
            new Point(10, 10),
            Color.Black);

        TextRenderer.MeasureText(
            e.Graphics,
            "Test",
            SystemFonts.DefaultFont,
            new Size(200, 50));
    }
}


Even though Test() is never called, compilation fails.
The compiler reports:

The type 'IGraphics' is defined in an assembly that is not referenced.
You must add a reference to assembly
'System.Private.Windows.GdiPlus, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'.


The same error occurs for `IGraphicsContextInfo`.

On one computer, manually adding `System.Private.Windows.GdiPlus.dll` through the DisplayFusion References dialog fails with:

The following reference(s) failed to be added successfully.
Please make sure that they are compatible with .NET 10
or .NET Standard 2.x.

- System.Private.CoreLib.dll

Could not load file or assembly
'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.2\System.Private.CoreLib.dll'.

The system cannot find the file specified.

Exception.HResult: COR_E_FILENOTFOUND (0x80070002)
FileNotFoundException.FileName:
C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.2\System.Private.CoreLib.dll


However, the file does exist (Test-Path returns True).

On another computer, adding the assembly does not produce this reference-loading error, but the script still fails to compile with the original IGraphics / IGraphicsContextInfo errors.

Tested Environments:

Computer 1:
- DisplayFusion 12.1.1
- .NET Runtime 10.0.2
- .NET SDK 10.0.102
- Windows Desktop Runtime 10.0.2
- The .NET 10 reference assembly exists at `C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\10.0.2\ref\net10.0\System.Private.Windows.GdiPlus.dll`

Computer 2:
- DisplayFusion 12.1.1
- .NET Runtime 10.0.14
- No .NET SDK installed
- Manually adding the assembly succeeds, but compilation still fails

Working Workaround

The following code compiles successfully:

IDeviceContext dc = (IDeviceContext)(object)e.Graphics;

TextRenderer.DrawText(
    dc,
    "Test",
    SystemFonts.DefaultFont,
    new Point(10, 10),
    Color.Black);


However, a direct assignment fails:

IDeviceContext dc = e.Graphics;


This strongly suggests a compile-time assembly reference resolution issue rather than a runtime issue.

The workaround is functional, but I would prefer not to rely on an unnecessary cast through `object` just to compile a standard WinForms API call.

Expected Behavior

DisplayFusion should compile standard WinForms code using `Graphics` and `TextRenderer` without requiring manual references or workarounds, regardless of whether a standalone .NET SDK is installed.

Questions

1. Is this a known issue with the DisplayFusion 12.1.x scripted function compiler?
2. Does DisplayFusion automatically include `System.Private.Windows.GdiPlus.dll` in its compilation references?
3. Is there a fix planned or already available in a beta release?

This appears similar to a .NET 10 reference resolution issue reported to Microsoft and fixed in .NET SDK 10.0.101:

https://github.com/dotnet/sdk/issues

Thanks!
9 hours ago  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
I was able to reproduce this here, so we've added it to our list to look into.

Thanks!
1 hour ago  • #2
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)