Bug 42908 - XAMLC Task Failed Unexpectedly on first run
Summary: XAMLC Task Failed Unexpectedly on first run
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Xamarin.Forms ()
Version: 4.1.2 (C7SR1)
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
: 42909 ()
Depends on:
Blocks:
 
Reported: 2016-07-28 20:01 UTC by Cody Beyer (MSFT)
Modified: 2016-12-27 08:36 UTC (History)
6 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Cody Beyer (MSFT) 2016-07-28 20:01:55 UTC
# Description

Upon creating a Xamarin Forms project, the following warning is thrown:

>The "XamlCTask" task failed unexpectedly.

# Exception

>System.IO.FileNotFoundException: Could not find file 'F:\Projects\Personal\Csharp\FormsPortableTest_V3\FormsPortableTest_V3\FormsPortableTest_V3.Droid\obj\Debug\FormsPortableTest_V3.Droid.dll'.
>File name: >'F:\Projects\Personal\Csharp\FormsPortableTest_V3\FormsPortableTest_V3\FormsPortableTest_V3.Droid\obj\Debug\FormsPortableTest_V3.Droid.dll'
>   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
>   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
>   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
>   at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
>   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
>   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
>   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
>   at Microsoft.Build.Framework.ITask.Execute()
>   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
>   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	FormsPortableTest_V3.Droid

# Steps to Reproduce

	1. Open Visual Studio
	2. New Project > Visual C# > Cross-Platform > Blank App (Xamarin Forms Shared or Portable)
	
# Expected Results

Project(s) should be created without error

# Actaul Results

Above referenced error is visible in Warnings pad

# Versions

Microsoft Visual Studio Professional 2015
Version 14.0.25424.00 Update 3
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Professional

LightSwitch for Visual Studio 2015   00322-40000-00000-AA256
Microsoft LightSwitch for Visual Studio 2015

Visual Basic 2015   00322-40000-00000-AA256
Microsoft Visual Basic 2015

Visual C# 2015   00322-40000-00000-AA256
Microsoft Visual C# 2015

Visual C++ 2015   00322-40000-00000-AA256
Microsoft Visual C++ 2015

Visual F# 2015   00322-40000-00000-AA256
Microsoft Visual F# 2015

Windows Phone SDK 8.0 - ENU   00322-40000-00000-AA256
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   7.1.00719.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11107.0
ASP.NET and Web Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript   1.8.35.0
TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25420.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   4.1.2.14 (1b3e004)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Inspector Support   0.9.0.14 (4d868da)
Adds support for inspecting Xamarin and WPF apps.

Xamarin.Android   6.1.2.20 (4a7d97a)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   9.8.2.19 (a5ae61c)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-12-27 02:33:32 UTC
It looks like at the time this bug was filed the core problem was that XamarinVS Cycle 7 SR 1 was using quite an old version of Xamarin.Forms into the templates.  More recent versions of XamarinVS include more recent versions of Xamarin.Forms in the templates and no longer hit this problem.

As for the fix in the Xamarin.Forms package itself, I think the cleanup that was done in the Xamarin.Forms .targets file to fix Bug 33181 was likely what solved this warning message.




## Steps followed to test (completed once for the shared template and once for the PCL template)

(a) GOOD: If I upgrade the projects in XamarinVS 4.1.2.18 (Cycle 7 SR 1) to Xamarin.Forms 2.2.0.45 and then complete the "reset steps" as described below, the particular warning mentioned in Comment 0 _no longer occurs_.

(b) BAD: If I downgrade the projects _back_ to Xamarin.Forms 2.0.0.6482 and then complete the "reset steps" as described below, the warning mentioned in Comment 0 _reappears_.

(c) GOOD: If I create a new project from template in XamarinVS 4.2.1.64 (Cycle 8 SR 1), the warning does _not_ appear (because the project is already using Xamarin.Forms 2.2.0.45).


### Reset steps (used after changing Xamarin.Forms versions)

1. Quit Visual Studio.
2. Delete the hidden .vs directory in the solution directory.
3. Re-open the solution.
4. Quit Visual Studio again.
5. Re-open the solution once more.

(Testing note: The repetition of quitting and restarting Visual Studio again in steps 4 and 5 was _crucial_ to observe the difference in behavior when using the PCL template on XamarinVS Cycle 7 SR 1.  But I was able to skip this repetition when testing on XamarinVS Cycle 8 SR 1.)




## Verification status for Xamarin.Forms: no longer reproducible as of 2.2.0.45 (and maybe earlier)

> GOOD: Xamarin.Forms 2.2.0.45    (May 30, 2016)
> BAD:  Xamarin.Forms 2.0.0.6482  (November 17, 2015)




## Verification status for the templates in Xamarin for Visual Studio: fixed as of 4.2.1 Cycle 8 SR 1 (and maybe earlier)


> GOOD: XamarinVS 4.2.1.64  (872717c)  Cycle 8 Service Release 1  (November 22, 2016)
The cross-platform project templates use Xamarin.Forms 2.2.0.45.


> BAD:  XamarinVS 4.1.2.18  (fcbe082)  Cycle 7 Service Release 1  (August 1, 2016)
The cross-platform project templates use Xamarin.Forms 2.0.0.6482.




## Additional testing environment info (brief)

Android SDK Tools 24.0.2
Android SDK Platform-tools 21
Android SDK Build-tools 23.0.1

Java JDK 8u111 (1.8.0_111) 64-bit

Microsoft Visual Studio Enterprise 2015
Version 14.0.25425.01 Update 3

Microsoft .NET Framework
Version 4.6.01055

Windows 8.1 (64-bit), Version 6.3 (Build 9600)
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2016-12-27 02:44:12 UTC
## Status update

This bug has now been marked "verified" based on the testing in Comment 1.  If any user comes across a similar warning message in the future when using Xamarin.Forms 2.2.0.45 or higher, please submit a new bug report that includes as many details [1] as possible.  Thanks in advance!

[1] https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/howto-file-bug/
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2016-12-27 08:36:50 UTC
*** Bug 42909 has been marked as a duplicate of this bug. ***