Skip to content

Conversation

@safern
Copy link
Member

@safern safern commented Jan 3, 2022

Summary

The runtime switch should not go under a runtimeOptions node.

Related to: dotnet/runtime#63027

@gewarren gewarren merged commit 60fffab into main Jan 3, 2022
@gewarren gewarren deleted the updateErrorOnDrawingUnixDoc branch January 3, 2022 21:11
@patelhitul
Copy link

This still does not work. I have following runtimeconfig.json

{
"runtimeOptions": {
"tfm": "net6.0",
"includedFrameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "6.0.0"
}
]
},
"configProperties": {
"System.GC.Server": true,
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Reflection.NullabilityInfoContext.IsSupported": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
"System.Drawing.EnableUnixSupport": true
}
}

and it still throws PlatformNotSupportedException

Microsoft.Reporting.NETCore.LocalProcessingException: An error occurred during local report processing.
---> System.TypeInitializationException: The type initializer for 'Microsoft.ReportingServices.Rendering.ImageRenderer.Renderer' threw an exception.
---> System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.
at System.Drawing.Image..ctor()
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at Microsoft.ReportingServices.Rendering.ImageRenderer.Renderer..cctor()

@gewarren
Copy link
Contributor

@patelhitul The switch was removed in .NET 7, however, I see you are targeting .NET 6, so I'm not sure. I wonder if the setting is being overwritten somehow. @tarekgh Can you help?

@tarekgh
Copy link
Member

tarekgh commented Sep 22, 2022

I have created a small console app on Ubuntu v22 which is targeting net6.0. I have created runtimeconfig.template.json file with the following contents:

{
      "configProperties": {
         "System.Drawing.EnableUnixSupport": true
      }
}

after compiling, it produced the file bin/Debug/net6.0/SystemDrawingApp.runtimeconfig.json with the following contents:

{
  "runtimeOptions": {
    "tfm": "net6.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "6.0.0"
    },
    "configProperties": {
      "System.Drawing.EnableUnixSupport": true
    }
  }
}

I have the following code in the app

using System.Drawing;

Bitmap bitmap = new Bitmap(10, 10);
Console.WriteLine($"{bitmap.Width} ... {bitmap. Height}");

and that ran fine without throwing any exception. If I remove the switch, the app will start throwing PlatformNotSupportedException as expected. I am running with .NET 6 version 6.0.401.

Conclusion, it looks to me it is correct to have configProperties section under the runtimeOptions and this current issue is incorrect.

@patelhitul if you still run into the problem, could you please provide a small app demo the problem? just ensure configProperties section under the runtimeOptions in the runtime config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants