Redth / ResizetizerNT

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

DEVOPS Azure IOS Build Failed in the latest Xamarin Forms 4.8 version #36

Closed BMBMove closed 3 years ago

BMBMove commented 3 years ago

The Build on Devops Azure with perfectly running fine until the project has been upgraded to the latest Xamarin forms with the following error. please help

ResizetizeImages: begin ForEach ForEach: [/Users/runner/work/1/s/BMB.ETE.ISELL/Images/accountcustomer.svg] ForEach: [/Users/runner/work/1/s/BMB.ETE.ISELL/Images/addnewsalesicon.svg] ForEach: [/Users/runner/work/1/s/BMB.ETE.ISELL/Images/deliverycheckedicon.svg] ForEach: [/Users/runner/work/1/s/BMB.ETE.ISELL/Images/stockposition.svg] ForEach: [/Users/runner/work/1/s/BMB.ETE.ISELL/Images/newopportunitymappin.svg] ForEach: [/Users/runner/work/1/s/BMB.ETE.ISELL/Images/arrowupdisabled.svg]

[error]Xamarin.iOS task failed with error Error: The process '/Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild' failed with exit code null. For guidance on setting up the build pipeline, see https://go.microsoft.com/fwlink/?LinkId=760847.

Finishing: XamariniOS

Redth commented 3 years ago

Build logs please.

BMBMove commented 3 years ago

BuildLog.docx Attached the log but it doesnt show much. when i removed the package it has executed normally.

Redth commented 3 years ago

Are you using 0.2.0? In every project that references it?

Can you provide a sample which reproduces the error?

fefferoni commented 3 years ago

I can confirm I have the same problem since I updated my solution to XF 4.8 and set my pipeline to use mono 6.10.0 or 6.12.0. build.log

I tried nuget version 0.1.0 and 0.2.0 of ResizetizerNT and have same problem. Only when I completely remove the nugets and references the build succeeds.

BMBMove commented 3 years ago

appreciate help on this matter as it's a real show stopper

fefferoni commented 3 years ago

Are you using 0.2.0? In every project that references it?

Can you provide a sample which reproduces the error?

I will try to set up a small sample project and see if it reproduces the issue.

fefferoni commented 3 years ago

Are you using 0.2.0? In every project that references it?

Can you provide a sample which reproduces the error?

Ok, I have now reproduced the issue with a simple dummy project. Once I add ResizetizerNT 0.2.0 and one svg file to the shared project the CI build in Azure Devops fails with error code null.

Here is the sample project (with pipeline yaml included) and the build log. sampleAppBuild.log sample.zip

Redth commented 3 years ago

Thanks, not much info in the logs that is helping figure this out. I'm working with someone else who also is able to reproduce this issue, but still haven't figured out exactly what's happening.... Stay tuned...

BMBMove commented 3 years ago

Any News on this matter, is there any approximation when it can be done, it's really a show stopper and in case it will still be delayed please let us know.

BMBMove commented 3 years ago

kind reminder

Redth commented 3 years ago

Made a bit more progress. It's been a it of a mystery how the msbuild process is terminating suddenly and there isn't really anything in the logs to help figure out what's going on. Even the binlogs are corrupt as if the file handle is terminated before it's expected.

I was able to recreate the setup in a devops pipeline where I invoked the msbuild command with bash and found that it's exiting with a 137 exit code, which seems to indicate an out of memory exception. Now, this is with a project with a single image in it, so I don't believe it's the number of images causing the problem.

Judging by the logs and build output it seems the resizetizer.inputs file gets written successfully so I do think the Collection images target runs fully, and then it crashes trying to load all of the assemblies required to instantiate the actual resizing task. It would appear SkiaSharp and other dependencies are causing some sort of memory limit to be exceeded on the build host agents.

I'm asking around to see if I can get any more info on this....

Redth commented 3 years ago

Soooo after a long time of trying different things, I think I inadvertently discovered where some of the problem lies, but I'm not sure why yet.

Basically, after trying to use a nupkg of resizetizer built with more debug logging in it, I couldn't figure out why my nuget.config's additional feed wasn't being respected during nuget restore. Finally I decided to try removing:

- task: NuGetCommand@2
  inputs:
    restoreSolution: '**/*.sln'

From my devops pipeline and just adding the /r flag to the msbuild invocation.

Magically the build error went away.

Not sure why the difference exactly but please try this in your environment. If AppCenter is not doing it this way, we may need to file an issue with them to change it, or dig deeper into why the two nuget restore options behave differently.

BMBMove commented 3 years ago

i can confirm that the proposed solution worked and the solution was built successfully finally, thank you for your help. However the build time has almost doubled from 7 minutes to 14, do you think it's related to removing the Nuget Task? are you going to report an issue or bug at Devops Azure?

fefferoni commented 3 years ago
- task: NuGetCommand@2
  inputs:
    restoreSolution: '**/*.sln'

From my devops pipeline and just adding the /r flag to the msbuild invocation.

Magically the build error went away.

Not sure why the difference exactly but please try this in your environment. If AppCenter is not doing it this way, we may need to file an issue with them to change it, or dig deeper into why the two nuget restore options behave differently.

Hey, nice work detective! I will also give it a try soon. And check if my build time has changed.. Greetings from Sweden

svaldetero commented 3 years ago

This work around worked for me, but required hacking up my yaml for my Azure Devops pipelines. Is this a nuget, msbuild, or pipelines bug?