Bug 58206 - The "GenerateJavaStubs" task failed unexpectedly.
Summary: The "GenerateJavaStubs" task failed unexpectedly.
Status: RESOLVED NORESPONSE
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: 5.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-07-18 05:49 UTC by gavin.fong
Modified: 2017-10-13 17:44 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
build diagnostic output log (662.13 KB, text/plain)
2017-07-20 01:39 UTC, gavin.fong
Details

Description gavin.fong 2017-07-18 05:49:43 UTC
Severity	Code	Description	Project	File	Line	Suppression State
Error		The "GenerateJavaStubs" task failed unexpectedly.
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.Max(IEnumerable`1 source)
   at Java.Interop.Tools.JavaCallableWrappers.TypeNameMapGenerator.WriteBinaryMapping(Stream o, Dictionary`2 mapping)
   at Java.Interop.Tools.JavaCallableWrappers.TypeNameMapGenerator.WriteJavaToManaged(Stream output)
   at Xamarin.Android.Tasks.GenerateJavaStubs.UpdateWhenChanged(String path, Action`1 generator)
   at Xamarin.Android.Tasks.GenerateJavaStubs.WriteTypeMappings(List`1 types)
   at Xamarin.Android.Tasks.GenerateJavaStubs.Run()
   at Xamarin.Android.Tasks.GenerateJavaStubs.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	simpleAndroidApp
Comment 1 Jon Douglas [MSFT] 2017-07-18 05:56:28 UTC
Can you please attach a full diagnostic build output log?

https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output

Secondly, if you have a reproduction project that you can add to this bug report, this can help us investigate this issue further.

Finally, we will want your current Version Information found in Help -> About Visual Studio.

Thank you for the report!
Comment 2 gavin.fong 2017-07-18 09:20:01 UTC
This is the error message i found in the output panel.


Severity	Code	Description	Project	File	Line	Suppression State
Error		The "GenerateJavaStubs" task failed unexpectedly.
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.Max(IEnumerable`1 source)
   at Java.Interop.Tools.JavaCallableWrappers.TypeNameMapGenerator.WriteBinaryMapping(Stream o, Dictionary`2 mapping)
   at Java.Interop.Tools.JavaCallableWrappers.TypeNameMapGenerator.WriteJavaToManaged(Stream output)
   at Xamarin.Android.Tasks.GenerateJavaStubs.UpdateWhenChanged(String path, Action`1 generator)
   at Xamarin.Android.Tasks.GenerateJavaStubs.WriteTypeMappings(List`1 types)
   at Xamarin.Android.Tasks.GenerateJavaStubs.Run()
   at Xamarin.Android.Tasks.GenerateJavaStubs.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	AppLogin	C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets	1682


Version: 14.0.25431.01 Update 3
Comment 3 Jon Douglas [MSFT] 2017-07-18 15:10:37 UTC
Hi Gavin,

Please send us a diagnostic build output log as per my instructions here:

https://bugzilla.xamarin.com/show_bug.cgi?id=58206#c1

This will have much more information pertaining to this situation.

Thank you!
Comment 4 gavin.fong 2017-07-20 01:39:26 UTC
Created attachment 23672 [details]
build diagnostic output log

Hi Jon,

Is this the log files requested?
Comment 5 Jon Douglas [MSFT] 2017-08-21 21:40:27 UTC
(In reply to gavin.fong from comment #4)
> Created attachment 23672 [details]
> build diagnostic output log
> 
> Hi Jon,
> 
> Is this the log files requested?

Yes thank you very much.

After looking through the diagnostic build output, it looks like we will need a reproduction project to figure out what item is causing this error.

1>    ResolvedAssemblies: (TaskId:199)
1>      obj\Debug\android\assets\AppLogin.dll (TaskId:199)
1>      obj\Debug\android\assets\Java.Interop.dll (TaskId:199)
1>      obj\Debug\android\assets\Mono.Android.dll (TaskId:199)
1>      obj\Debug\android\assets\mscorlib.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Core.dll (TaskId:199)
1>      obj\Debug\android\assets\System.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Xml.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Xml.Linq.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Threading.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Runtime.dll (TaskId:199)
1>      obj\Debug\android\assets\System.ComponentModel.Composition.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Collections.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Collections.Concurrent.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Diagnostics.Debug.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Reflection.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Linq.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Runtime.InteropServices.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Runtime.Extensions.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Reflection.Extensions.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Net.Http.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Runtime.Serialization.dll (TaskId:199)
1>      obj\Debug\android\assets\System.ServiceModel.Internals.dll (TaskId:199)
1>    ResolvedUserAssemblies: (TaskId:199)
1>      obj\Debug\android\assets\AppLogin.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Threading.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Runtime.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Collections.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Collections.Concurrent.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Diagnostics.Debug.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Reflection.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Linq.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Runtime.InteropServices.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Runtime.Extensions.dll (TaskId:199)
1>      obj\Debug\android\assets\System.Reflection.Extensions.dll (TaskId:199)

Seems failure is within Java.Interop with the task failing in the Generator. Here's a stack trace of the open source bits:

https://github.com/xamarin/xamarin-android/blob/b423ff68a6d11230bb493c3cb0633ff2a9c37b20/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs#L280-L287

https://github.com/xamarin/java.interop/blob/cd2e96be07d4e0a0e0950af556bf85b3fc25d249/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers/TypeNameMapGenerator.cs#L130

https://github.com/xamarin/java.interop/blob/cd2e96be07d4e0a0e0950af556bf85b3fc25d249/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers/TypeNameMapGenerator.cs#L172-L187

Thus we will need to run your project to figure out the culprit! Thanks in advance.
Comment 6 Jon Douglas [MSFT] 2017-10-13 17:44:30 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!

Note You need to log in before you can comment on or make changes to this bug.