-
Notifications
You must be signed in to change notification settings - Fork 369
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
'dotnet new android' produces invalid images #3325
Comments
@jonathanpeppers I tried to reproduce this bug, but was not able two - the files in template and in generated output are identical. In general I would recommend to use "copy-only" mode for files without replacements (see the link). This will avoid any file modification, the file will be copied from template content, and also should be faster as template engine will not scan the file content for variables. Update: I was able to reproduce the issue, however only using dotnet/installer to install dotnet new. We should look on what has been changed in dotnet-sdk or dotnet/installer in these timeframe which started causing the issue. |
I can confirm adding this to our "sources": [
{
"source": "./",
"target": "./",
"copyOnly": "**/Resources/**/*.png"
}
], I'll set this up on any iOS/Android templates for |
Context: dotnet/templating#3325 Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation In the current bump, `dotnet new android` + `dotnet build` fails with: Resources\mipmap-xxxhdpi\ic_launcher_round.png error APT2000: failed reading from input: PNG chunk type 49444154 is too large: chunk length is 10836 but chunk starts at byte 45/8187. The .NET templating system has a 'copyOnly' mode for files that do not need any text replaced. This is a performance feature, but it also happens to workaround this issue. We should be doing this on `.png` files *anyway*, as we don't need potential "text" to be replaced. I will probably need to make similar changes in xamarin/xamarin-macios and dotnet/maui.
Context: dotnet/templating#3325 Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation In the current bump, `dotnet new android` + `dotnet build` fails with: Resources\mipmap-xxxhdpi\ic_launcher_round.png error APT2000: failed reading from input: PNG chunk type 49444154 is too large: chunk length is 10836 but chunk starts at byte 45/8187. The .NET templating system has a 'copyOnly' mode for files that do not need any text replaced. This is a performance feature, but it also happens to workaround this issue. We should be doing this on `.png` files *anyway*, as we don't need potential "text" to be replaced. I will probably need to make similar changes in xamarin/xamarin-macios and dotnet/maui.
Changes: dotnet/installer@abb57b4...12636f6 Changes: dotnet/linker@21df7db...f90f5c9 Changes: dotnet/runtime@5b8e178...8bb087d * Update dependencies from https://github.com/dotnet/installer build 20210623.1 Microsoft.Dotnet.Sdk.Internal From Version 6.0.100-preview.6.21313.2 to 6.0.100-preview.6.21323.1 Dependency coherency updates * Microsoft.NET.ILLink.Tasks: from 6.0.100-preview.6.21304.2 to 6.0.100-preview.6.21314.2 * Microsoft.NETCore.App.Ref: from 6.0.0-preview.6.21306.1 to 6.0.0-preview.6.21317.12 * [tests] temporarily skip asserts in BuildBasicBindingLibrary Context: dotnet/msbuild#6609 It seems that properties are missing from MSBuild logs, ignoring part of this test for now. * [templates] set .png files to `copyOnly` Context: dotnet/templating#3325 Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation In the current bump, `dotnet new android` + `dotnet build` fails with: Resources\mipmap-xxxhdpi\ic_launcher_round.png error APT2000: failed reading from input: PNG chunk type 49444154 is too large: chunk length is 10836 but chunk starts at byte 45/8187. The .NET templating system has a `copyOnly` mode for files that do not need any text replaced. This is a performance feature, but it also happens to workaround this issue. We should be doing this on `.png` files *anyway*, as we don't need potential "text" to be replaced. I will probably need to make similar changes in xamarin/xamarin-macios and dotnet/maui. Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
Changes: dotnet/installer@abb57b4...38e12ca Changes: dotnet/linker@21df7db...c739a81 Changes: dotnet/runtime@5b8e178...24950a3 Updates: * Microsoft.Dotnet.Sdk.Internal: from 6.0.100-preview.6.21313.2 to 6.0.100-preview.7.21321.2 * Microsoft.NET.ILLink.Tasks: from 6.0.100-preview.6.21304.2 to 6.0.100-preview.6.21317.4 * Microsoft.NETCore.App.Ref: from 6.0.0-preview.6.21306.1 to 6.0.0-preview.7.21319.2 * Remove workarounds for <RuntimeConfigParserTask/> Context: dotnet/runtime#53811 dotnet/runtime#53811 is now solved, so we can remove the workaround. * Update .apkdesc files * [tests] temporarily skip asserts in BuildBasicBindingLibrary Context: dotnet/msbuild#6609 It seems that properties are missing from MSBuild logs, ignoring part of this test for now. * [templates] set .png files to `copyOnly` Context: dotnet/templating#3325 Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation In the current bump, `dotnet new android` + `dotnet build` fails with: Resources\mipmap-xxxhdpi\ic_launcher_round.png error APT2000: failed reading from input: PNG chunk type 49444154 is too large: chunk length is 10836 but chunk starts at byte 45/8187. The .NET templating system has a `copyOnly` mode for files that do not need any text replaced. This is a performance feature, but it also happens to workaround this issue. We should be doing this on `.png` files *anyway*, as we don't need potential "text" to be replaced. I will probably need to make similar changes in xamarin/xamarin-macios and dotnet/maui. Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
The cause of the issue is: dotnet/runtime#53502, dotnet/docs#24649. It is strongly recommended to use |
Context: dotnet/templating#3325 Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation In current .NET 6 Preview 6 builds, there is an issue if a template includes a binary file larger than ~8kb, it seems to get truncated when `dotnet new` extracts the template. A workaround is to use the `copyOnly` feature for binary files. Really, we should be doing this anyway, because otherwise the templating system considers replacing *text* in these binary files. It improves performance to do this and would hopefully prevent a future bug of random bytes getting replaced.
Context: dotnet/templating#3325 Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation In current .NET 6 Preview 6 builds, there is an issue if a template includes a binary file larger than ~8kb, it seems to get truncated when `dotnet new` extracts the template. A workaround is to use the `copyOnly` feature for binary files. Really, we should be doing this anyway, because otherwise the templating system considers replacing *text* in these binary files. It improves performance to do this and would hopefully prevent a future bug of random bytes getting replaced.
Context: dotnet/templating#3325 Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation In current .NET 6 Preview 6 builds, there is an issue if a template includes a binary file larger than ~8kb, it seems to get truncated when `dotnet new` extracts the template. A workaround is to use the `copyOnly` feature for binary files. Really, we should be doing this anyway, because otherwise the templating system considers replacing *text* in these binary files. It improves performance to do this and would hopefully prevent a future bug of random bytes getting replaced.
Context: dotnet/templating#3325 Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation In current .NET 6 Preview 6 builds, there is an issue if a template includes a binary file larger than ~8kb, it seems to get truncated when `dotnet new` extracts the template. A workaround is to use the `copyOnly` feature for binary files. Really, we should be doing this anyway, because otherwise the templating system considers replacing *text* in these binary files. It improves performance to do this and would hopefully prevent a future bug of random bytes getting replaced. Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
Context: dotnet/templating#3325 Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation In current .NET 6 Preview 6 builds, there is an issue if a template includes a binary file larger than ~8kb, it seems to get truncated when `dotnet new` extracts the template. A workaround is to use the `copyOnly` feature for binary files. Really, we should be doing this anyway, because otherwise the templating system considers replacing *text* in these binary files. It improves performance to do this and would hopefully prevent a future bug of random bytes getting replaced. For .NET MAUI, the following files need `copyOnly`: * `wwwroot/css` folder has several types of fonts inside * `.svg` and `.ttf` files
Context: dotnet/templating#3325 Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json#content-manipulation In current .NET 6 Preview 6 builds, there is an issue if a template includes a binary file larger than ~8kb, it seems to get truncated when `dotnet new` extracts the template. A workaround is to use the `copyOnly` feature for binary files. Really, we should be doing this anyway, because otherwise the templating system considers replacing *text* in these binary files. It improves performance to do this and would hopefully prevent a future bug of random bytes getting replaced. For .NET MAUI, the following files need `copyOnly`: * `wwwroot/css` folder has several types of fonts inside * `.svg` and `.ttf` files
Our templates: microsoft.android.templates.30.0.100-preview.6.56.nupkg.zip
If you
dotnet new android
you get a broken image that is coincidentally ~8kb:This broken image causes
dotnet build
to fail when calling the underlying Android tooling:If I unzip this file myself (with a tool like 7-zip), it is actually larger than ~8kb:
I suspect if a template has a file larger than ~8kb you'll hit this issue.
This started happening in Maestro bumps here:
So likely the issue started somewhere bumping .NET 6.0.100-preview.6.21313.2 to 6.0.100-preview.6.21321.13.
The text was updated successfully, but these errors were encountered: