You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to get this Library working under a .net core 2.1 app on my ubuntu 18.04 server.
During this process I was getting some weird errors which were eventually boiled down to being the exact same issue like THIS
If I understood correctly, the usage of "FromHwnd" will basically invoke some code which requires a graphical interface to be present. As my server is purely a "backend" I dont really want to install an x-server just for plotting some graphs. This would be my last resort...
I am not familar with the Details, but as the solution on stackoverflow suggest, might there be a way to use Graphics.FromImage() at this place without any loss of funtionality?
I think this would greatly benefit cross-platform compatibility :)
Hi @Hexxonite, you did good investigation. One more step is to make PR to fix that. You are best candidate, because you can easy reproduce your problem.
Gfx object you point used only for MeasureString(). I think it safe to make replacement you suggested. It may have some side effects because FromHwnd may contain some DPI scaling information, not sure.
If you get exception on Graphics.FromHwnd(IntPtr.Zero), safest way to fix as i see:
Does Azure piplines use Windows instances to run tests? Its good improvement to setup additional Linux based pipeline for test, to avoid problems like this issue.
The method you proposed is working fine, however I encountered another error where the "Segoe UI"-Font wouldn't be found. So I created a Helper-Class to check if any preffered defaults exist on the system and replaced the static strings in some cases.
During this I also encountered the "CourierNew" Font being used in some cases by "markers"? But I personally dont use these and didn't have any problems. Some further investigation might be required though...
Regarding the Azure Pipeline I sadly dont have any knowledge but it seems like a good idea for sure :)
Hi @Hexxonite, thanks for reporting this and issuing a PR. I'll refine the PR a bit then merge it in today.
@StendProg thanks for your early reply. Azure Pipelines is just building on a Windows system, but I'll add Linux to it today and ensure ScottPlot builds and tests pass.
Activity
StendProg commentedon Jan 20, 2020
Hi @Hexxonite, you did good investigation. One more step is to make PR to fix that. You are best candidate, because you can easy reproduce your problem.
Gfx object you point used only for
MeasureString(). I think it safe to make replacement you suggested. It may have some side effects becauseFromHwndmay contain some DPI scaling information, not sure.If you get exception on
Graphics.FromHwnd(IntPtr.Zero), safest way to fix as i see:Does Azure piplines use Windows instances to run tests? Its good improvement to setup additional Linux based pipeline for test, to avoid problems like this issue.
hexxone commentedon Jan 20, 2020
Hi again and Thanks for the quick response :)
The method you proposed is working fine, however I encountered another error where the "Segoe UI"-Font wouldn't be found. So I created a Helper-Class to check if any preffered defaults exist on the system and replaced the static strings in some cases.
During this I also encountered the "CourierNew" Font being used in some cases by "markers"? But I personally dont use these and didn't have any problems. Some further investigation might be required though...
Regarding the Azure Pipeline I sadly dont have any knowledge but it seems like a good idea for sure :)
Here is the PR:
#212
swharden commentedon Jan 20, 2020
Hi @Hexxonite, thanks for reporting this and issuing a PR. I'll refine the PR a bit then merge it in today.
@StendProg thanks for your early reply. Azure Pipelines is just building on a Windows system, but I'll add Linux to it today and ensure ScottPlot builds and tests pass.
The Azure Pipelines configuration file is: /dev/devops/azure-pipelines.yml
[-]Library requires xserver on linux[/-][+]improve support for Linux and macOS[/+]swharden commentedon Jan 21, 2020
fixed, see notes in #212
fix manual Y tick spacing bug
build and test on Linux and macOS
create a non-GUI solution for build/testing on Linux
dont use FromHwnd ever
fix manual Y tick spacing bug
only get OSX-specific packages on OSX