question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GetColormaps() throws on second call

See original GitHub issue

ScottPlot.Drawing.Colormap.GetColormaps() throws on second call. There is related with Reflection exception.

var colormaps = ScottPlot.Drawing.Colormap.GetColormaps();
var colormaps1 = ScottPlot.Drawing.Colormap.GetColormaps();

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
StendProgcommented, Feb 11, 2021

I just want to fill combobox with available Colormaps names. Then user change selection i want to create new Colormap by provided name. It’s possible to achive with existing GetColormaps() method, but i get LoadType exception.

Maybe it worth to make hard-coded list of available colormaps, and realise 2 additional api methods:

  1. string[] GetAvailableColormapsNames();
  2. Colormap CreateColormap(string name);

As far as I understand, reflection is used to simplify the addition Colormaps, but one way or another, all Colormaps are hard-coded in these methods: https://github.com/ScottPlot/ScottPlot/blob/d2055308885c747443c902053749882a4be0b174/src/ScottPlot/Drawing/Colormap.cs#L13-L43 Maybe we should give up the use of reflection?

0reactions
StendProgcommented, Feb 11, 2021

ConsoleApp.csproj

I just now realized that this is most likely the case, I got this error in a fairly old project, the project file was created in the old version of the VS2015 or older and has the old format, most likely this is the case. In general, the problem is most likely on my side, sorry to bother you. But getting this 2 methods without reflection would still be great, and without creating 20+ Colormaps objects just to pull names out of them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simulate first call fails, second call succeeds
From the docs: Sometimes we need to stub with different return value/exception for the same method call. Typical use case could be mocking ......
Read more >
ImageServiceInfo (ArcObjects Java API)
Convert the object to another object that is supported. ... public ISpatialReference getSpatialReference() throws java.io.IOException, AutomationException.
Read more >
Lua/Functions
This is a comprehensive list of all functions that can be utilized by Lua scripting, excluding those that are part of userdata structures....
Read more >
Cell Density Map - Image Analysis
Hi, I'm looking for a way to compute cell density map, based on already segmented cells (in 2D). My goal is to visually...
Read more >
API
Convert stored pixel data to image data. For uint16 pack uint16 into two uint8 channels (r and a). Parameters. image Image A Cornerstone...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found