dapplo / Dapplo.Jira

This is a simple REST based JIRA client, written for Greenshot, by using Dapplo.HttpExtension
MIT License
35 stars 14 forks source link

Disable avatar bitmap functionality #49

Closed bluee closed 4 years ago

bluee commented 4 years ago

In .NET Core 3.1 (Azure function) I get this error which seems to be related to Avatar bitmap handling. Is it possible to disable this to avoid dependency on PresentationCore?


   at Dapplo.HttpExtensions.ContentConverter.BitmapSourceHttpContentConverter.CanConvertToHttpContent(Type typeToConvert, Object content) in d:\a\1\s\src\Dapplo.HttpExtensions\ContentConverter\BitmapSourceHttpContentConverter.cs:line 78
   at Dapplo.HttpExtensions.Factory.HttpContentFactory.<>c__DisplayClass3_0.<Create>b__1(IHttpContentConverter x) in d:\a\1\s\src\Dapplo.HttpExtensions\Factory\HttpContentFactory.cs:line 162
   at System.Linq.OrderedEnumerable`1.TryGetFirst(Func`2 predicate, Boolean& found)
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Dapplo.HttpExtensions.Factory.HttpContentFactory.Create(IHttpBehaviour httpBehaviour, Type inputType, Object content, String contentType) in d:\a\1\s\src\Dapplo.HttpExtensions\Factory\HttpContentFactory.cs:line 162
   at Dapplo.HttpExtensions.Factory.HttpContentFactory.Create(Type inputType, Object content) in 
Lakritzator commented 4 years ago

I think that is fixable, if only you would have copied the start of the exception so I know what the error is 🤷

What version are you using, and what are you trying to do? From the stacktrace it's not really visible what you are calling.

Lakritzator commented 4 years ago

After thinking about this, I still got some questions.

Are you actually trying to use the avatar bitmaps?

AFAIK the BitmapSourceHttpContentConverter is not added out of the box, at least not in the latest version. Did you add this yourself?

I currently have no code yet to handle bitmap content without System.Drawing or PresentationCore. You might want to use ImageSharp for this... I'd be interested in a PR for this, if you are going that way.

Lakritzator commented 4 years ago

I even double checked, there is no reference to PresentationCore in the current version of the dotnet core 3.1 build of Dapplo.Jira or Dapplo.HttpExtensions.

bluee commented 4 years ago

Hi, I'm not using the Bitmap functionality. I added Dapplo.Jira to a .NET Core 3.1 Azure Function and got the above exception on my localhost. My workaround for now is to just use REST queries so nothing urgent.

All I did was to add a Dapplo.Jira to an clean Azure function 3.1 template. Do one query for a Jira ID. That's it.

Lakritzator commented 4 years ago

As I asked before, can you add the nuget version you are using, and if possible the exception? I don't even see the information which makes you say that it's due to a dependency to PresentationCore.

I'm not sure what is triggering the error you are seeing, as normally you have to DO something actively to make Dapplo.Jira retrieve a bitmap. But unfortunately you are not really providing me much input.

What do you mean with one query for a Jira ID, can you show the code?

Lakritzator commented 4 years ago

Ping?

bluee commented 4 years ago

I have tried to re-produce the issue as I didn't keep the original code but without luck. Please close for now and I will re-open if I can re-produce it at a later stage. Thanks.

Lakritzator commented 4 years ago

Thank you for the feed back, that comforts me... I think you were using an older version.