Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throwing Error for Gdip when creating a SolidBrush variable #30704

Closed
devilnest opened this issue Aug 28, 2019 · 1 comment
Closed

Throwing Error for Gdip when creating a SolidBrush variable #30704

devilnest opened this issue Aug 28, 2019 · 1 comment
Labels
area-System.Drawing untriaged New issue has not been triaged by the area owner
Milestone

Comments

@devilnest
Copy link

I found this is a common problem which can be resolved with installing libgdiplus but this 'trick' doesnt help in my case.

My spec:
Linux: centos-release-7-5.1804.el7.centos.2.x86_84
.NET Core version: 2.1
System.Drawing.Common (4.5.1)
libgdiplus: libgdiplus-2.10-10.el7.x86_64
also installed libgdipls-devel

Code which delivers a error:

class CardBuilder
{
   private readonly Brush _secondInformationColor = new SolidBrush(Color.FromArgb(179, 179, 179));

   public CardBuilder(){}
}

And the error is:
The type initializer for 'Gdip' threw an exception.
at System.Drawing.SafeNativeMethods.Gdip.GdipCreateSolidFill(Int32 color, IntPtr& brush)
at System.Drawing.SolidBrush..ctor(Color color)

If I find a solution, I will put the answer in the current issue

[EDIT:]
Changing to NET CORE 2.2 : doesn't help

@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 5.0 milestone Feb 1, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 23, 2020
@safern safern modified the milestones: 5.0.0, Future Jul 6, 2020
@safern
Copy link
Member

safern commented Jul 6, 2020

Thanks @devilnest

This is definitely that we're not finding libgdiplus installed in the OS and that is why we're failing when GDI is initialized.

This thread has a bunch of instructions on how to set it up correctly. dotnet/core#2746

Please let me know if that doesn't help.

@safern safern closed this as completed Jul 6, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Drawing untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

4 participants