7

I want to improve performance of my Xamarin.Forms UWP application because it is extremely slow in Release mode (".NET native" checked). So I apply XAMLC at the assembly level in the PCL project:

[assembly: XamlCompilation (XamlCompilationOptions.Compile)]
namespace MyApp
{
}

but with this attribute I receive runtime error:

"Method not found: 'Void Xamarin.Forms.Xaml.Internals.SimpleValueTargetProvider..ctor(System.Object[])'."

According to this:

https://github.com/xamarin/Xamarin.Forms/blob/master/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.Internals/SimpleValueTargetProvider.xml

the SimpleValueTargetProvider class has 2 versions:

  • 1.5.0.0 - constructor with one parameter System.Object[]
  • 2.0.0.0 - constructor with 2 parameters System.Object[] and System.Object

I use Xamarin.Forms 2.3.3.163-pre3 so I use the second version in my project (when I navigate to SimpleValueTargetProvider in Xamarin.Forms.Xaml.Internals I can see constructor with 2 parameters). My understanding is that apparently "something" is still calling SimpleValueTargetProvider 1.5.0.0, but I have no idea what it is.

I removed all of the third-party components but it did not help. I used fusion log to find out what is going on but this is all I get (to be honest I don't know if this is related to the issue I'm facing at all):

> *** Assembly Binder Log Entry  (10/26/2016 @ 9:09:42 PM) ***
> 
> The operation failed. Bind result: hr = 0x80070002. The system cannot
> find the file specified.
> 
> Assembly manager loaded from: 
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under
> executable  C:\Program Files (x86)\Microsoft Visual
> Studio\VS15Preview\Common7\IDE\devenv.exe
> --- A detailed error log follows. 
> 
> === Pre-bind state information === LOG: DisplayName = XamlDesignerFaultInjection  (Partial) WRN: Partial binding information
> was supplied for an assembly: WRN: Assembly Name:
> XamlDesignerFaultInjection | Domain ID: 1 WRN: A partial bind occurs
> when only part of the assembly display name is provided. WRN: This
> might result in the binder loading an incorrect assembly. WRN: It is
> recommended to provide a fully specified textual identity for the
> assembly, WRN: that consists of the simple name, version, culture, and
> public key token. WRN: See whitepaper
> http://go.microsoft.com/fwlink/?LinkId=109270 for more information and
> common solutions to this issue. LOG: Appbase = file:///C:/Program
> Files (x86)/Microsoft Visual Studio/VS15Preview/Common7/IDE/ LOG:
> Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base =
> NULL LOG: AppName = devenv.exe Calling assembly : (Unknown).
> === LOG: This bind starts in default load context. LOG: Using application configuration file:
> C:\Users\blaze\AppData\Local\Microsoft\VisualStudio\15.0_2f751565\devenv.exe.config
> LOG: Using host configuration file:  LOG: Using machine configuration
> file from
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
> LOG: Policy not being applied to reference at this time (private,
> custom, partial, or location-based assembly bind). LOG: Attempting
> download of new URL file:///C:/Program Files (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection.DLL. LOG:
> Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection.EXE. LOG:
> Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: All probing URLs attempted and failed.

Is this a bug in Xamarin.Forms or XamlCTask? Has anyone encountered this issue or knows how to fix it?

  • Windows 10 64-bit
  • Visual Studion 15 Preview 5
  • Xamarin 4.2.1.14
  • Xamarin.Forms 2.3.3.163-pre3

Thanks in advance

Blazey
  • 73
  • 1
  • 5

3 Answers3

12

This is most than probably a caching issue at the IDE or the project level.

If it's at IDE level: - do a clean - restart VS or XS - rebuild

but you probably tried that already.

My guess is that one of the nuget update didn't cleaned correctly, and you have different version of XF referenced on different project of your solution, or one .csproj file references the old .targets file.

Some manual housecleaning will solve the issue, hopefully.

Stephane Delcroix
  • 16,134
  • 5
  • 57
  • 85
  • Thanks Stephane! Manual cleaning solved the problem. – Blazey Oct 28 '16 at 08:39
  • 1
    @Blazey what is manual cleaning? deleting everything in the packages folder or removing all packages from the project? – Emil Nov 02 '16 at 22:02
  • I edited .csproj in Notepad and removed all the old references to XF. – Blazey Nov 28 '16 at 07:41
  • Had the same problem and a simple rebuild didn't fixed it, so, I cleaned everything, closed the IDE, deleted the packages folder (at solution's root), deleted obj and bin folders of the projects, restarted VS, restored packages. rebuilt everything. – Morgan Touverey Quilling Dec 01 '16 at 12:56
  • 2
    If you're a git user, you can `git clean -xdf` in your project root. Just make sure any changes are staged/committed. – Kent Boogaart Jan 19 '17 at 23:12
  • @MorganTouvereyQuilling, Any advice on how to do this manual cleaning on a Mac? I don't see the named folders in the directories created by Visual Studio. – Le Mot Juiced Feb 05 '19 at 15:38
4

If your project depends on a 3rd party assembly that uses XamlC, and if that assembly has been build on XF<2.3.3, you still can get this issue.

A fix exists and will be released as part of the first service release for XF 2.3.3

Stephane Delcroix
  • 16,134
  • 5
  • 57
  • 85
0

On my side, I had different Xamarin.Forms version on my Core and Android version. Install the same on all projects solve it

draco951
  • 226
  • 3
  • 13