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

Seems FontThumbnailService isn't fully working on Azure AppService #17

Open
jonascarlbaum opened this issue Feb 2, 2021 · 3 comments
Open

Comments

@jonascarlbaum
Copy link

jonascarlbaum commented Feb 2, 2021

Same code works differently locally and in cloud (Azure AppService). Some thumbs won't load in Azure, everyone works locally. Same ttf-file locally and on Azure.

Used like this, won't work on Azure:

[ThumbnailIcon("fa-light-300.ttf", 0xf015)]

Used like this, works on Azure:

[ThumbnailIcon("fa-light-300.ttf", 0xf1ea)]

Error:

Parameter is not valid. at System.Drawing.Bitmap..ctor(String filename)

image

Seems like some icons works to generate thumbnails from, and some won't.

image
Some files seems to be zero sized too.


It seems like new Bitmap(path) won't work reliably in Cloud see here and here since .

Error exists in FontThumbnailService.cs.

Proposed fix might be changing this, if new Bitmap works best with stream instead of path:

if (File.Exists(cachePath))
{
    using (var bmpTemp = new Bitmap(cachePath))
    {
       return new Bitmap(bmpTemp);
    }
}

to this (dummy-coded):

if (File.Exists(cachePath))
{
    using (StreamReader sr = new StreamReader(cachePath)) 
    {
        using (var bmpTemp = new Bitmap(sr))
        {
            return new Bitmap(bmpTemp);
        }
    }
}
@jonascarlbaum
Copy link
Author

jonascarlbaum commented Feb 2, 2021

Clearing cached thumbnails didn't work.
But I managed to solve it by clearing the cached thumbnails and restart Azure AppService.

So that's an interesting behaviour. ;)

@degborta
Copy link
Collaborator

degborta commented Feb 9, 2021

Yeah, that's strange.. I'll give it a look and see if I can reproduce it.

@jonascarlbaum
Copy link
Author

@degborta Seems like same behaviour occurs over time on local machine too — can check error logs the next time it happens. It happened after adding new thumbnails and Re-compiled. IIS-reset after clearing thumbs works locally too as a ”fix”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants