Redth / ResizetizerNT

Add SVG's and PNG's to your shared Xamarin Project
MIT License
318 stars 31 forks source link

AppCentre build issue with resizetizer.nt 0.1.0 #8

Closed GeorgeLeithead closed 4 years ago

GeorgeLeithead commented 4 years ago

When I build my project locally, it builds OK. When building via AppCentre, I "occasionally" get the following error. If I submit the build again with no changes, it will occasionally build successfully.

ResizetizeImages: Open SVG took 282ms Open SVG took 282ms Open SVG took 282ms new SKSvg() took 0ms Open SVG took 282ms new SKSvg() took 0ms Open SVG took 282ms new SKSvg() took 0ms new SKSvg() took 0ms new SKSvg() took 0ms Open SVG took 284ms new SKSvg() took 0ms svg.FromSvgDocument took 55ms svg.FromSvgDocument took 57ms svg.FromSvgDocument took 57ms svg.FromSvgDocument took 57ms svg.FromSvgDocument took 57ms svg.FromSvgDocument took 58ms Save Image took 9ms Save Image took 10ms Save Image took 10ms Save Image took 11ms Save Image took 0ms Save Image took 11ms Save Image took 12ms Save Image took 1ms Save Image took 1ms Save Image took 3ms Save Image took 3ms Save Image took 2ms Save Image took 2ms Save Image took 4ms Save Image took 4ms Save Image took 4ms Save Image took 8ms Save Image took 14ms Save Image took 9ms Save Image took 4ms Save Image took 9ms Save Image took 19ms Save Image took 14ms Open SVG took 3ms new SKSvg() took 0ms svg.FromSvgDocument took 0ms Save Image took 0ms Save Image took 10ms Save Image took 0ms Save Image took 4ms Save Image took 23ms Save Image took 1ms Save Image took 1ms Save Image took 25ms Open SVG took 9ms new SKSvg() took 0ms Save Image took 14ms Open SVG took 7ms new SKSvg() took 0ms svg.FromSvgDocument took 0ms Save Image took 29ms Save Image took 0ms Save Image took 0ms Save Image took 0ms Save Image took 34ms Save Image took 1ms svg.FromSvgDocument took 9ms Open SVG took 5ms new SKSvg() took 0ms Save Image took 1ms Save Image took 2ms Open SVG took 9ms new SKSvg() took 0ms svg.FromSvgDocument took 2ms Save Image took 1ms svg.FromSvgDocument took 0ms Save Image took 1ms Open SVG took 6ms new SKSvg() took 0ms Save Image took 1ms svg.FromSvgDocument took 1ms Open SVG took 5ms new SKSvg() took 0ms svg.FromSvgDocument took 0ms Save Image took 0ms Save Image took 2ms Save Image took 2ms Save Image took 0ms Save Image took 3ms Save Image took 3ms Save Image took 9ms Save Image took 5ms Save Image took 1ms Save Image took 12ms Save Image took 1ms Save Image took 48ms Save Image took 4ms Save Image took 3ms Save Image took 10ms Save Image took 9ms Save Image took 4ms Save Image took 10ms Save Image took 10ms Save Image took 17ms Open SVG took 5ms new SKSvg() took 0ms svg.FromSvgDocument took 1ms Save Image took 1ms Save Image took 21ms Save Image took 2ms Save Image took 21ms Save Image took 4ms Open SVG took 3ms new SKSvg() took 0ms svg.FromSvgDocument took 0ms Save Image took 2ms Save Image took 3ms Save Image took 8ms Save Image took 4ms Save Image took 13ms Save Image took 10ms Save Image took 45ms

/Users/runner/.nuget/packages/resizetizer.nt/0.1.0/buildTransitive/Resizetizer.NT.targets(155,3): error : Object reference not set to an instance of an object [/Users/runner/runners/2.166.4/work/1/s/Source/XXXmyapplicationXXX.csproj]

This is the code from the csproj, and I can confirm that all of the SVG files exist in the project.

    <ItemGroup>
        <None Remove="SharedImages\btc.svg" />
        <None Remove="SharedImages\eth.svg" />
        <None Remove="SharedImages\eos.svg" />
        <None Remove="SharedImages\xrp.svg" />
    </ItemGroup>

    <ItemGroup>
        <SharedImage Include="SharedImages\btc.svg" BaseSize="32,32" />
        <SharedImage Include="SharedImages\eth.svg" BaseSize="32,32" />
        <SharedImage Include="SharedImages\eos.svg" BaseSize="32,32" />
        <SharedImage Include="SharedImages\xrp.svg" BaseSize="32,32" />
    </ItemGroup>
GeorgeLeithead commented 4 years ago

NOTE: I immediately just set off another build in AppCentre with zero changes, and it built zero problems.

AdamDiament commented 4 years ago

Love the tool, thanks! Found out about it on Microsoft xamarin youtube channel.

I also have this exact same issue on app center for my android builds (not tested iOS yet) since incorporating nuget version 0.1.0. It seems to affect about 1 in every 2/3 builds. Rebuilding the same failed build with no changes often results in a success.

Feroks commented 4 years ago

Having the same issue. Happens for both UWP and Android projects.

cas8180 commented 4 years ago

Same exact issue for me as well in VS Mac as well as App Center. For us and our dev team its kind of becomes a known issue. How we work around it is, to do a full clean solution and rebuild. A few attempts at this and eventually you will get a successful build. We would really appreciate a fix for this and this significantly slows down our productivity and creates very rough automated deployments + distributions.

bmacombe commented 4 years ago

I can confirm I'm having the same problem on Azure DevOps, but only with my iOS project. Android and UWP seem fine.

ThumbGen commented 4 years ago

I can confirm I'm having the same problem on Azure DevOps (self-hosted) only on iOS project. Even retrying fails all the time on the MacMini (on premises) :( Kind of a showstopper.

GeorgeLeithead commented 4 years ago

Happens randomly on GitHub Actions, Azure DevOps and App Centre. Simply rerunning the build most always results in a successful build. You can see the GitHub Actions build for example, here: https://github.com/GeorgeLeithead/LiLo.Lite

knasher commented 4 years ago

This happens with annoying regularity in Azure DevOps at the moment

acuntex commented 4 years ago

I get the same error in Jetbrains Rider when Loading/Building the Android project.

acuntex commented 4 years ago

Also get it in Visual Studio Code, does not seem to be specific to a Build Server or IDE... Deleting the obj/bin folder does fix it for the moment.

ThumbGen commented 4 years ago

I have the feeling that this happens for non-AppStore configurations only. Tried 3-4 times to build for AppStore and it worked smoothly. But now it fails constantly when building a Debug configuration.

bmacombe commented 4 years ago

@Redth Anything I could do to help with this problem? I'd be willing to look into it, but I don't even know where to start to test or debug a MS Build task. I'll do some research into it though.

Redth commented 4 years ago

Yeah I'll be looking at this soon. I'm also not entirely sure where to start debugging this as I can't reproduce it locally, but it's on my list!

bmacombe commented 4 years ago

Thanks, I'm glad to help if I can...hit me up for sure if you need a tester on any changes.

acuntex commented 4 years ago

@Redth Error does not only occur on Android projects, just got the error on iOS. It generally only occurs after starting the IDE, once you delete the bin/obj folder and try again it works until the IDE is closed.

It's Some NullRef in the C# Build Task. Maybe you could do the following?

try
{
   // Current code
}
catch(Exception e)
{
  // print exception message/stacktrace etc.?
  throw;
}
babduljameel commented 4 years ago

I also see the error on my android build project /Users/runner/.nuget/packages/resizetizer.nt/0.1.0/buildTransitive/Resizetizer.NT.targets(155,3): error : Object reference not set to an instance of an object [/Users/runner/work/1/s/Src/SampleProject/SampleProject.Android/SampleProject.Android.csproj]

LukasThijs commented 4 years ago

I am also having the:

/Users/runner/.nuget/packages/resizetizer.nt/0.1.0/buildTransitive/Resizetizer.NT.targets(155,3): error : Object reference not set to an instance of an object [/Users/runner/work/1/s/Src/SampleProject/SampleProject.Android/SampleProject.Android.csproj]

Can I generate the platform specific images from the appcenter pre-build script?

This issue only occurs on Android.

IvoKrugers commented 4 years ago

I'm also experiencing this like @LukasThijs mentioned. Is there a way to patch this? Do some command line stuff in the pre-build script?

IvoKrugers commented 4 years ago

I can reproduce this locally by cleaning the solution + deleting obj/bin folders and then rebuilding the solution. Our solution has a Core and UI project apart from the platform specific projects. The images are in the UI project.

Redth commented 4 years ago

I think this may stem from some memory issues in SkiaSharp itself.

I've updated the package to use a newer version of SkiaSharp (and Skia.Svg among other things).

Please give the 0.2.0-preview1 a try and see if this problem is resolved.

bmacombe commented 4 years ago

Just updated and ran a Dev Ops Build

resizetizer.nt/0.2.0-preview1/buildTransitive/Resizetizer.NT.targets(155,3): error : Object reference not set to an instance of an object

it was the iOS project that failed

Just some extra info, my build machine is a Mac Mini with 8 gigs of ram, I'm not using a Dev Ops hosted mac

bmacombe commented 4 years ago

It's consistently failing now though when before it was random. I've run 4 in a row of my iOS build and they have all failed at the same point with the same error.

I've run it 10 times now and it fails every time. So it seems there is at least a change with the updated Skia, because before it would work one time and then fail the next, etc

Redth commented 4 years ago

Do you have build logs? Is this just the iOS project failing on AppCenter CI? (so, mac build agents)?

bmacombe commented 4 years ago

Here is the build log. I'm running this in Azure Dev Ops on my own Mac Mini 5_Build iOS.zip

UWP and Android work fine.

bmacombe commented 4 years ago

I just connected Win VS to that same Mac Mini and did a local build and it worked fine. The only difference between the local and CI would be debug vs release

Redth commented 4 years ago

I just tested running on macOS and it's working fine for me.

If you're able to get the build failure on macOS on your Mac Mini with a /bl (binary log), that would be very helpful!

bmacombe commented 4 years ago

I'll try a release build run out of VS and see what happens.

Think MSBuild vs xbuild would make a difference? I know my Dev Ops is using MSBuild, I don't know what is being run when I just build from Visual Studio

bmacombe commented 4 years ago

Running the same build as I run in Dev Ops out of Win VS paired to the same Mac Mini completed fine, must be some difference compared to Dev Ops. I'll see if I can add that extra log flag to the CI build

bmacombe commented 4 years ago

@Redth This is interesting. I added the /bl to the arguments of the Dev Ops task, it worked twice in a row. I removed the /bl and it failed again at the same time in the build with the same error.

Ran the build without /br twice, both failed. Added /br back and it worked fine.

That /bl is the only thing different between working every time so far and failing every time image

Redth commented 4 years ago

I'm not sure where to go with this next... My apps are building fine with 0.2.0-preview1 in DevOps repeatedly now... no failures yet...

bmacombe commented 4 years ago

I'll keep playing with it, but without a good repro it's going to be hard to track down.

Not sure it would make a difference but I see in using v1 of the ios build task, so maybe I'll try v2 and see if it makes a difference.

ThumbGen commented 4 years ago

Same error with 0.2.0 in my Azure DevOps self-hosted environment (MacMini 16GB RAM) and also when building from command line (for UI tests) on a different MacMini 16GB. Still work reliably when building from inside Visual Studio for Mac.

Bombs for both Android and iOS.

BMBMove commented 4 years ago

Same Issue here, working fine from Visual Studio but not able to build neither from App Center, nor from Azure Pipeline. For both Android and IOS

Redth commented 4 years ago

If anyone can capture a binlog when this failure happens that would be helpful. (msbuild /bl).

BMBMove commented 4 years ago

I can send you the log from devops will that be usefull?

Regards,

Elie Yacoub Technical Manager

From: Jonathan Dick notifications@github.com Reply-To: Redth/ResizetizerNT reply@reply.github.com Date: Wednesday, September 16, 2020 at 8:33 PM To: Redth/ResizetizerNT ResizetizerNT@noreply.github.com Cc: Elie Yacoub elie.yacoub@bmbgroup.com, Comment comment@noreply.github.com Subject: Re: [Redth/ResizetizerNT] AppCentre build issue with resizetizer.nt 0.1.0 (#8)

If anyone can capture a binlog when this failure happens that would be helpful. (msbuild /bl).

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Redth/ResizetizerNT/issues/8#issuecomment-693553227, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOYBEWG6RRGKQLI5NJSYGCLSGDZHJANCNFSM4MVOQVPQ.

Redth commented 4 years ago

If it’s a binlog yes, otherwise maybe not so much. But can’t hurt to see 👍

bondarenkod commented 4 years ago

I started getting this error on each build after I updated to the latest verstion. Previously, restarting the build sometimes helped to avoid this error.

I can't share the BL. Will try to help you in another way.

/Users/user/.nuget/packages/resizetizer.nt/0.2.0-preview1/buildTransitive/Resizetizer.NT.targets(155,3): error : Object reference not set to an instance of an object [/Volumes/DATA/agents/OSX-01/_work/1/s/prj.Droid/prj.Droid.csproj]

bondarenkod commented 4 years ago

@BMBMove could you attach your log as a file?

bondarenkod commented 4 years ago

@Redth image /Users/user/.nuget/packages/resizetizer.nt/0.8.0/buildTransitive/Resizetizer.NT.targets(155,3): error : null img [/Volumes/DATA/agents/sdfsd-OSX-01/_work/3/s/sdfsdf.sdfsdf.iOS/sdfdsf.sdfsdf.iOS.csproj

It seems like some elements in the resizedImages collection is null.

BMBMove commented 4 years ago

Sure, here it is.

Regards,

Elie Yacoub Technical Manager

From: Dmytro Bondarenko notifications@github.com Reply-To: Redth/ResizetizerNT reply@reply.github.com Date: Saturday, September 19, 2020 at 9:06 PM To: Redth/ResizetizerNT ResizetizerNT@noreply.github.com Cc: Elie Yacoub elie.yacoub@bmbgroup.com, Mention mention@noreply.github.com Subject: Re: [Redth/ResizetizerNT] AppCentre build issue with resizetizer.nt 0.1.0 (#8)

@BMBMovehttps://github.com/BMBMove could you attach your log as a file?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Redth/ResizetizerNT/issues/8#issuecomment-695339187, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOYBEWHECA5T3QPL3UBIRILSGTXIXANCNFSM4MVOQVPQ.

BMBMove commented 4 years ago

what do you mean?

bondarenkod commented 4 years ago

what do you mean?

your message with the log is too long

BMBMove commented 4 years ago

sorry for that

BMBMove commented 4 years ago

attached the document

BMBMove commented 4 years ago

build.zip

bondarenkod commented 4 years ago

@Redth there are a few null items in a resizedImages collection 2020-09-19T18:44:50.3554880Z img[0] is null = True 2020-09-19T18:44:50.3554980Z img[1] is null = True 2020-09-19T18:44:50.3555090Z img[2] is null = True 2020-09-19T18:44:50.3555190Z img[3] is null = True

BMBMove commented 4 years ago

Who is this possible? How do we figure out which one is null? Why it does not happen all the time?

bondarenkod commented 4 years ago

@BMBMove could you try this nuget in your project and run the build with it and attach the new build log? It's contain a small workaround, it's supposed to safely handle the error, but you will probably lose some images from result.

BMBMove commented 4 years ago

I will give it a try and get back to you

bondarenkod commented 4 years ago

@BMBMove try after this one too, https://www.myget.org/feed/serenity-xf/package/nuget/Resizetizer.NT/0.12.0 it's fixed version. I hope.

I also want to see the log from the previous post to check if we had the similar issues.