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

dotnet publish ends after hours with buffer overflow when publishing dotnet maui app. #81271

Closed
vsfeedback opened this issue Jan 13, 2023 · 13 comments

Comments

@vsfeedback
Copy link

vsfeedback commented Jan 13, 2023

This issue has been moved from a ticket on Developer Community.


Dotnet maui publishing takes forever and ends with errors if the 3 packages CommunityToolkit.Maui, CommunityToolkit.Mvvm, Microsoft.Graph are included in the project.
To reproduce:

  • in Visual Studio create new dotnet Maui project with dotnet 7.
  • Install the Nuget packages mentioned above. Microsoft.Graph as preview 5.0.0-rc.1
  • Modify MauiProgram.cs to use the CommunityToolkit. (as in the published readme)
  • Create key with
    keytool -genkey -v -keystore key.keystore -alias rempel -keyalg RSA -keysize 2048 -validity 10000
  • Include key entry in project file:

True.
 key.keystore
rempel

  • Create the project in Visual Studio.
  • Publish the project with
    dotnet publish -f:net7.0-android -c:Release /p:AndroidSigningKeyPass="PASSWORD" /p:AndroidSigningStorePass="PASSWORD"
  • Go get yourself a coffee or two.... After a few hours, the process aborts with errors.(-1073740791(0xC0000409) seems to be a buffer overflow).

If I use

<PublishTrimmed>False</PublishTrimmed>
<EnableTrimAnalyzer>False</EnableTrimAnalyzer>
<RunAOTCompilation>False</RunAOTCompilation>

the publishing works, but as expected it ends with a huge file.

It may be wrong to include packages that are not or hardly used. But in my project I need small parts of all the packages and get the same error.

dotnet --info:

.NET SDK:
 Version:   7.0.101
 Commit:    bb24aafa11

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.22000
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.101\

Host:
  Version:      7.0.1
  Architecture: x64
  Commit:       97203d38ba

.NET SDKs installed:
  6.0.102 [C:\Program Files\dotnet\sdk]
  6.0.200-preview.22055.15 [C:\Program Files\dotnet\sdk]
  7.0.100-rc.2.22477.23 [C:\Program Files\dotnet\sdk]
  7.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0-rc.2.22476.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0-rc.2.22472.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.0-rc.2.22472.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Original Comments

Feedback Bot on 1/5/2023, 07:29 PM:

(private comment, text removed)

YanFang Wang (CSI Interfusion Inc) [MSFT] on 1/6/2023, 04:06 AM:

(private comment, text removed)

Andreas Sprick-Schütte on 1/6/2023, 04:20 AM:

(private comment, text removed)

Feedback Bot on 1/9/2023, 07:25 AM:

(private comment, text removed)


Original Solutions

(no solutions)

@Nick-Stanton
Copy link
Member

@jfversluis do you have any insights here?

@jfversluis
Copy link
Member

That's very interesting. Never heard it before. Does this happen ONLY with those three packages? Or if you uninstall one of them does that seem to resolve the issue?

I have experience with the MVVM and Toolkit ones and I never heard of this before, so maybe if we just uninstall the Graph one, does it start working then? Or if not that one, can we reinstall the Graph one and then uninstall one of the others and try to narrow it down to 1 package?

Also I guess a binlog file would help to see what the build is actually doing. Almost seems like it ends up in an infinite loop somehow.

@ghost
Copy link

ghost commented Jan 16, 2023

Hi @vsfeedback. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@AsPaper
Copy link

AsPaper commented Jan 17, 2023

Hi Gerald,
thank you for taking care. Sorry that the answer took so long, but some attempts take 2.5 hours.
So, I have tried all possible combinations. It seems that Microsoft.Graph in combination with one of the other two packages leads to the problem. All other combinations work.
In detail:

Worked:
Only Graph RC2 : msbuildonlygraphrc2.binlog
Only CommunityToolkit.Mvvm: msbuildonlymvvm.binlog
CommunityToolkit.Mvvm and CommunityToolkit.Maui msbuildmvvmAndMaui.binlog

Did not work:
All three packages: msbuildwithall.binlog
MS Graph RC1 and CommunityToolkit.Maui: msbuildgraphrc1AndMaui.binlog
MS Graph RC2 and CommunityToolkit.Maui: msbuildgraphrc2AndMauiToolkit.binlog
MS Graph RC2 and CommunityToolkit.Mvvm: msbuildGraphRc2AndMVVM.binlog
msbuildbinlogs.zip

@jfversluis
Copy link
Member

@jonathanpeppers @dellis1972 could you maybe have a look what might be going on here? Thanks!

@jonathanpeppers
Copy link
Member

The error is failing inside the AOT compiler:

C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.4\targets\Microsoft.Android.Sdk.Aot.targets(91,5): Precompiling failed for C:\VS2015\Projects\MauiProbTestApp1\MauiProbTestApp1\obj\Release\net7.0-android\android-arm\linked\Microsoft.Graph.dll with exit code -1073740791.
Mono Ahead of Time compiler - compiling assembly C:\VS2015\Projects\MauiProbTestApp1\MauiProbTestApp1\obj\Release\net7.0-android\android-arm\linked\Microsoft.Graph.dll
AOTID 2496DF67-40B9-F5AD-4697-EA20A7D059C0
Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.52\Sdk\maui.aotprofile'
Using profile data file 'C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\7.0.52\Sdk\maui-blazor.aotprofile'
Added 0 methods from profile.
Added 0 methods from profile.
* Assertion at D:\a\_work\1\s\src\mono\mono\mini\aot-compiler.c:11219, condition `table_size < 65000' not met [C:\VS2015\Projects\MauiProbTestApp1\MauiProbTestApp1\MauiProbTestApp1.csproj]

So, I think we move this to dotnet/runtime where src\mono\mono\mini\aot-compiler.c lives.

@AsPaper does it work around the problem if you put <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot> in your project? I see how it mentions Added 0 methods from profile..

You could, of course, also set <RunAOTCompilation>false</RunAOTCompilation> to completely turn off AOT for now.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@jonathanpeppers jonathanpeppers transferred this issue from dotnet/maui Jan 27, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jan 27, 2023
@jonathanpeppers
Copy link
Member

/cc @steveisok you might know who would be best to look at this one.

@steveisok
Copy link
Member

/cc @vargaz

@vargaz
Copy link
Contributor

vargaz commented Jan 29, 2023

Can somebody reproduce this locally ?

@drossoft
Copy link

drossoft commented May 22, 2023

same issue when I add Microsoft.Graph (5.11.0) to my project.

Tried with <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot> but doesn't work. The only way to build in release is with <RunAOTCompilation>false</RunAOTCompilation>

@NickDarvey
Copy link

@vargaz, there's a very easy repo. You can just build this Microsoft.Graph sample repo in release mode.

microsoftgraph/msgraph-sample-maui#68

  1. Clone https://github.com/microsoftgraph/msgraph-sample-maui
  2. Remove bundle resource 'appSettings.Development.json' from project
  3. Run dotnet publish -c Release -f net7.0-ios16.1 -r ios-arm64

@vargaz
Copy link
Contributor

vargaz commented Jun 1, 2023

Duplicate of:
#85917

@vargaz vargaz closed this as completed Jun 1, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jun 1, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jul 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants