Error3 The "CompileXaml" task failed unexpectedly - windows-phone-7

I am working with Xamarin and I have a error when I want to compile it.
This is the folowing
Error 3 The "CompileXaml" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'XamlServicesWP, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'XamlServicesWP, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Server stack trace:
at Microsoft.Silverlight.Build.Tasks.CompileXaml.GenerateCode(ITaskItem item, Boolean isApplication)
at Microsoft.Silverlight.Build.Tasks.CompileXaml.Execute()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Build.Framework.ITask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Hello.WinPhone
Since I have tried (for example I installed the Windows Phone 8.1 and 8.0 SDK and Windows Phone 8.1 emulator Update 3) some similar error added
in this forum and I could not fix it, maybe someone could help me. would it be possible?
Thanks in advance
Alejandro

Related

Xamarin Apps Build on VS2017 but not VS for Mac

I'm able to build the app in Windows on the latest version of VS2017 (15.9.2) for both Android and iOS, and I'm able to use the Remote iOS Simulator to run my iOS app as built on my Mac. However, when I use the same solution on my 2009 iMac on High Sierra in Visual Studio for Mac, I get an exception on one of my .NET Standard libraries from sgen.exe when msbuild attempts to generate the serialization assemblies:
Unhandled Exception:
System.TypeLoadException: Could not load type of field '<TYPENAME>+<>c__DisplayClass3_0:obj' (0) due to: Could not load file or assembly 'Newtonsoft.Json,
Version=12.0.0.0,
Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
To try to get past this, I commented out the class that is failing (within cs in the exception above) along with the using statements in that file related to Newtonsoft.Json. After doing this, I get the following exception:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
at System.Xml.Serialization.XmlSerializationWriterCodeGen.FindXmlnsIndex (System.Xml.Serialization.MemberMapping[] members) [0x00014] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.XmlSerializationWriterCodeGen.WriteStructMethod (System.Xml.Serialization.StructMapping mapping) [0x00359] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.XmlSerializationWriterCodeGen.GenerateMethod (System.Xml.Serialization.TypeMapping mapping) [0x00024] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.XmlSerializationCodeGen.GenerateReferencedMethods () [0x0001b] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.XmlSerializationWriterCodeGen.GenerateEnd () [0x00000] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.TempAssembly.GenerateAssembly (System.Xml.Serialization.XmlMapping[] xmlMappings, System.Type[] types, System.String defaultNamespace, System.Security.Policy.Evidence evidence, System.Xml.Serialization.XmlSerializerCompilerParameters parameters, System.Reflection.Assembly assembly, System.Collections.Hashtable assemblies) [0x003a7] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.XmlSerializer.GenerateSerializer (System.Type[] types, System.Xml.Serialization.XmlMapping[] mappings, System.CodeDom.Compiler.CompilerParameters parameters) [0x000cb] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at Driver.Run (System.String[] args) [0x0042c] in <4ef54e9b09fa46d8995a283d81fa42c0>:0
at Driver.Main (System.String[] args) [0x00005] in <4ef54e9b09fa46d8995a283d81fa42c0>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at System.Xml.Serialization.XmlSerializationWriterCodeGen.FindXmlnsIndex (System.Xml.Serialization.MemberMapping[] members) [0x00014] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.XmlSerializationWriterCodeGen.WriteStructMethod (System.Xml.Serialization.StructMapping mapping) [0x00359] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.XmlSerializationWriterCodeGen.GenerateMethod (System.Xml.Serialization.TypeMapping mapping) [0x00024] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.XmlSerializationCodeGen.GenerateReferencedMethods () [0x0001b] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.XmlSerializationWriterCodeGen.GenerateEnd () [0x00000] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.TempAssembly.GenerateAssembly (System.Xml.Serialization.XmlMapping[] xmlMappings, System.Type[] types, System.String defaultNamespace, System.Security.Policy.Evidence evidence, System.Xml.Serialization.XmlSerializerCompilerParameters parameters, System.Reflection.Assembly assembly, System.Collections.Hashtable assemblies) [0x003a7] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at System.Xml.Serialization.XmlSerializer.GenerateSerializer (System.Type[] types, System.Xml.Serialization.XmlMapping[] mappings, System.CodeDom.Compiler.CompilerParameters parameters) [0x000cb] in <9e212f4dac634c83bb98a320d2c5ec4d>:0
at Driver.Run (System.String[] args) [0x0042c] in <4ef54e9b09fa46d8995a283d81fa42c0>:0
at Driver.Main (System.String[] args) [0x00005] in <4ef54e9b09fa46d8995a283d81fa42c0>:0 /Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(3553, 5): error MSB6006: "sgen.exe" exited with code 1. Done building target "GenerateSerializationAssemblies" in project "<PROJECTNAME>.csproj" -- FAILED.
I've also tried the following:
Changing the linker behavior from anything to not linking at all to linking everything. There was no difference.
Setting "Generate Serialization Assembly" to "Off" in the project settings. The app built in Windows, but while loading it crashes. There does not appear to be an option to control this in Visual Studio for Mac.
Changing all PCL projects to .NET Standard 2.0 projects and changing all Xamarin Droid or iOS projects to use PackageReferences instead of the package.config
Adding the latest version of Newtonsoft.Json to all projects in the solution
Updated Mono, Xamarin and VS for Mac to the latest versions
Does anybody have any ideas? Again, both iOS and Android builds seem to work in Visual Studio 2017 on Windows, but they do not on my Mac. Thanks in advance for your help!

Install Visual Studio 2015 express on Windows 7

I have read this, this, this, this and this questions and answers, none of them have help me at all.
I'm trying to install Visual Studio 2015 Express or Community edition, I have W7 SP1, I have tried with admin rights, I've checked that no preview VS have been installed but no matter what I do, I still can't install VS and I don't understand what the log says, I'll append a picture and what I think is an important part of the log file:
[0D48:1794][2015-10-20T19:36:45]i000: MUX: Feed uri to register: http://go.microsoft.com/fwlink/?LinkID=558779&clcid=0x409
[0D48:1794][2015-10-20T19:36:47]e000: MUX: Exception: Info: Unable to load dynamic feed
[0D48:1794][2015-10-20T19:36:47]e000: MUX: ERROR: Could not load file or assembly 'System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.
[0D48:1794][2015-10-20T19:36:47]e000: MUX: Stack: at Microsoft.Web.PlatformInstaller.Util.IsSignatureValid(String xmlFile)
at Microsoft.Web.PlatformInstaller.ProductManager.LoadFromXml(String xmlFile, Boolean loadEnclosures, Boolean isOnlineFeedLoaded, Boolean verifySignature)
at Microsoft.Web.PlatformInstaller.ProductManager.Load(Uri productFileUrl, Boolean filterByArchitectureAndOS, Boolean loadEnclosures, Boolean useCachedVersion, String cacheDirectory, Architecture architecture, Int32 osType, String& finalFeedCacheLocation, Boolean& isOnlineFeedLoaded, Boolean& onlineFeedLoadError, String localFeed, Boolean verifySignature, String feedUri, String lastUsedFeedLocationKey, BundleProperties currentBundle)
at Microsoft.Web.PlatformInstaller.ProductManager.Load(Uri productFileUrl, Boolean filterByArchitectureAndOS, Boolean loadEnclosures, Boolean useCachedVersion, String cacheDirectory, String& finalFeedCacheLocation, Boolean& isOnlineFeedLoaded, Boolean& onlineFeedLoadError, String localFeed, Boolean verifySignature, String feedUri, String lastUsedFeedLocationKey, BundleProperties currentBundle)
at Microsoft.Devdiv.Bootstrapper.Utility.SecondaryInstallerUtility.LoadProductManager()
[0D48:05C8][2015-10-20T19:36:54]i000: MUX: View loaded
[0D48:05C8][2015-10-20T19:36:54]i000: MUX: Go to Blocker page.
[0D48:05C8][2015-10-20T19:36:54]i199: Detect complete, result: 0x0
Apparently, the problem is in:
Could not load file or assembly
'System.Security, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'
UPDATE
After devlin carnate suggestion and reading answers from this site and this one too I have tried the following:
Update my OS. Except for the "update to W10" I have installed all updates (even some of those marked as optionals).
Run a "scan now" from command prompt, bassically, I followed instructions from this site, and even when something were marked as corrupted I don't know how to repair it ('cause no dll or file were detected).
Uninstall the .NET Framework and install a prev version (from 4.5 to 4) but the problem persist (also, after this, windows suggest to update to 4.5 so I reinstall 4.5 version).
Use the .NET Framework Repair Tool with no results.
UPDATE 2
I just format my HDD unit and reinstall (the same) W7 SP1 all over again, after that, I was able to install VS Community Edition, but I don't take this as a solution since is just too drastic and I don't know the original reason of why this happened in the first place.

Xamarin iOS - Could not load file or assembly 'System.Threading.Tasks' at startup

I just upgraded to Xamarin studio 5.9 (build 431), and cannot run my project anymore. It works with a clean project though.
When I run my app, I don't even land in Main.
The Application Output in Xamarin studio prints a bunch of assembly loadings. It gets to MobileClientiOS.app/Newtonsoft.Json.dll [External], then it crashes with the following output:
Could not load file or assembly 'System.Threading.Tasks' or one of its
dependencies. The system cannot find the file specified.
(System.IO.FileNotFoundException) at System.AppDomain.Load
(System.Reflection.AssemblyName assemblyRef,
System.Security.Policy.Evidence assemblySecurity) [0x00081] in
.../mono/mcs/class/corlib/System/AppDomain.cs:706 at
System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef)
[0x00000] in .../mono/mcs/class/corlib/System/AppDomain.cs:674 at
System.Reflection.Assembly.Load (System.Reflection.AssemblyName
assemblyRef) [0x00000] in
.../mono/mcs/class/corlib/System.Reflection/Assembly.cs:551 at
ObjCRuntime.Runtime.CollectReferencedAssemblies
(System.Collections.Generic.List 1 assemblies,
System.Reflection.Assembly assembly) [0x00019] in
.../maccore/src/ObjCRuntime/Runtime.cs:218 at
ObjCRuntime.Runtime.CollectReferencedAssemblies
(System.Collections.Generic.List 1 assemblies,
System.Reflection.Assembly assembly) [0x0002c] in
.../maccore/src/ObjCRuntime/Runtime.cs:220 at
ObjCRuntime.Runtime.CollectReferencedAssemblies
(System.Collections.Generic.List 1 assemblies,
System.Reflection.Assembly assembly) [0x0002c] in
.../maccore/src/ObjCRuntime/Runtime.cs:220 at
ObjCRuntime.Runtime.RegisterEntryAssembly (System.Reflection.Assembly
entry_assembly) [0x0001b] in
.../maccore/src/ObjCRuntime/Runtime.cs:200 at
ObjCRuntime.Runtime.RegisterEntryAssembly (IntPtr a) [0x00000] in
.../maccore/src/ObjCRuntime/Runtime.cs:158 at
ObjCRuntime.Runtime.register_entry_assembly (IntPtr assembly)
[0x00000] in .../maccore/runtime/Delegates.generated.cs:118 at
(wrapper native-to-managed)
ObjCRuntime.Runtime:register_entry_assembly (intptr) 2015-05-04
MobileClientiOS[77830:1943120] critical: Got a SIGABRT while
executing native code. This usually indicates a fatal error in the
mono runtime or one of the native libraries used by your application.
Sorry for the long stacktrace, but I'm out of ideas. We are using PCL's, but there haven't been a problem before this Xamarin Studio-upgrade.
Thank you!
Edit:
I downgraded Xamarin.iOS and it's working again. The assembly it seems to fail on is (which now works with the old version):
/MobileClientiOS.app/System.Xml.Linq.dll [External]
How to be able to run with the latest version? I do not know.
To make a guess, I think this might have the same underlying cause as Xamarin Bug 29211.
If that's true, then there's a good chance the same workaround will work:
Under "project options -> iOS Build -> Additional mtouch arguments" add:
-linkskip=System.Threading.Tasks
If that workaround does indeed work, then it's very likely the issue will be fixed in the upcoming service release (due to be released later this week).
Update July 2, 2015
It turns out there is another subtly different common cause of the problem for System.Threading.Tasks. That second bug was originally hidden by Bug 29211 because the two bugs are very similar. The second problem is now being tracked in Xamarin Bug 31560. Note that this bug only affects simulator builds and has fairly simple workarounds, so it is minor in severity.

Debugging mscorlib in .Net 4.0

I'm getting the following exception from System.IO.Path.CheckInvalidPathChars() in mscorlib:
[ArgumentException: Illegal characters
in path.]
System.IO.Path.CheckInvalidPathChars(String
path) +142
System.IO.Path.NormalizePath(String
path, Boolean fullCheck, Int32
maxPathLength) +100
System.IO.Path.GetFullPath(String
path) +187
System.Xml.XmlResolver.ResolveUri(Uri
baseUri, String relativeUri) +114
System.Xml.XmlTextReaderImpl..ctor(String
url, XmlNameTable nt) +135
System.Xml.XmlDocument.Load(String
filename) +85
Sitecore.Web.UI.WebControls.WebEditRibbon.ConvertToJson(String
layout) +210
Sitecore.Web.UI.WebControls.WebEditRibbon.Render(HtmlTextWriter
output, Item item) +1268
Sitecore.Web.UI.WebControl.Render(HtmlTextWriter
output) +387
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter
writer, ICollection children) +246
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter
writer) +315
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter
writer) +48
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter
writer, ControlAdapter adapter)
+11279890 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter
writer, ICollection children) +246
System.Web.UI.Page.Render(HtmlTextWriter
writer) +40
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) +5274
The thing is, I don't what the path value is that's causing this error. It would help if I could debug the method so I can see the value of the path parameter. I enabled stepping into the .Net Framework code in Visual Studio 2010. I've also loaded the related .Net Framework Symbols from the Microsoft Symbol Servers. However, it seems these PDBs don't include the source; so I can't step into CheckInvalidPathChars and retrieve the path value.
Is it possible to debug mscorlib and step through its source?
Relevant info:
.Net Framework 4.0.
Visual Studio 2010
Any constructive input is greatly appreciated.
Thanks,
Frank
You can get the reference source for the .NET libraries.
http://referencesource.microsoft.com/
Looking at your stacktrace, the problem appears to be originating in Sitecore.Web.UI.WebControls.WebEditRibbon.ConvertToJson. That thing is trying to load an XML file.
Using reflector would allow you to do that.
Is it possible that you enabled to break on all exceptions? Doing that would certainly account for internal exceptions showing up in the debugger. If this is the case, you can safely ignore the exception.
Well mscorlib.dll on your machine is of release build so even though you can very well debug into it, you won't be able to see values local variables/objects etc. The code in this binary is optimized. If you want perfect debugging experience of Microsoft .NET code then you will need to install debug version of .NET on your machine.

Error building Visual Studio 2010 Silverlight 4 projects on Windows 7 with XP Mode

I installed Visual Studio 2010 Beta 2 in an XP Mode VM on Windows 7. Then I created a trivial Silverlight 4 (beta) project and tried to build it. I get the following error:
Error 1 The "ValidateXaml" task failed
unexpectedly.
System.IO.FileLoadException: Could not
load file or assembly
'file://\tsclient\d\Users\me\Documents\Visual
Studio
2010\Projects\SilverlightApplication2\SilverlightApplication2\obj\Debug\SilverlightApplication2.dll'
or one of its dependencies. Operation
is not supported. (Exception from
HRESULT: 0x80131515)
File name:
'file://\tsclient\d\Users\me\Documents\Visual
Studio
2010\Projects\SilverlightApplication2\SilverlightApplication2\obj\Debug\SilverlightApplication2.dll'
---> System.NotSupportedException: An attempt was made to load an assembly
from a network location which would
have caused the assembly to be
sandboxed in previous versions of the
.NET Framework. This release of the
.NET Framework does not enable CAS
policy by default, so this load may be
dangerous. If this load is not
intended to sandbox the assembly,
please enable the
loadFromRemoteSources switch. See
http://go.microsoft.com/fwlink/?LinkId=155569
for more information.
at
System.Reflection.RuntimeAssembly._nLoad(AssemblyName
fileName, String codeBase, Evidence
assemblySecurity, RuntimeAssembly
locationHint, StackCrawlMark&
stackMark, Boolean
throwOnFileNotFound, Boolean
forIntrospection, Boolean
suppressSecurityChecks) at
System.Reflection.RuntimeAssembly.nLoad(AssemblyName
fileName, String codeBase, Evidence
assemblySecurity, RuntimeAssembly
locationHint, StackCrawlMark&
stackMark, Boolean
throwOnFileNotFound, Boolean
forIntrospection, Boolean
suppressSecurityChecks) at
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName
assemblyRef, Evidence
assemblySecurity, StackCrawlMark&
stackMark, Boolean forIntrospection,
Boolean suppressSecurityChecks) at
System.Reflection.RuntimeAssembly.InternalLoadFrom(String
assemblyFile, Evidence
securityEvidence, Byte[] hashValue,
AssemblyHashAlgorithm hashAlgorithm,
Boolean forIntrospection, Boolean
suppressSecurityChecks,
StackCrawlMark& stackMark) at
System.Reflection.Assembly.LoadFrom(String
assemblyFile) at
Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute(ITask
task) at
Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute(ITask
task) at
Microsoft.Silverlight.Build.Tasks.ValidateXaml.Execute()
at
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at
Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost
taskExecutionHost, TaskLoggingContext
taskLoggingContext, TaskHost taskHost,
ItemBucket bucket, TaskExecutionMode
howToExecuteTask, Boolean& taskResult)
I believe this is related to the fact that XP Mode redirects the My Documents folder to the host, turning it into a network share location, and some sort of CAS / security policy is being triggered.
Anyone know how to fix it?
Have you added <loadFromRemoteSources enabled="true"/> in your configuration file?
Enabling loadFromRemoteSources is also explained on http://social.msdn.microsoft.com/Forums/en-US/webdevelopmentprerelease/thread/ea9b9cab-cbfd-496d-8a81-7b3dd06e8c23 along with another option; set the environment variable COMPLUS_EnableLegacyCASPolicy.
Edit: (copy and paste from the above URL as the post got taken down)
David DeWinter - MSFT (Wednesday, May 20, 2009 2:10 AM)
Caveat: I'm not on the security team but will attempt to answer this nonetheless...
What's happening here is that the build tasks for Silverlight are attempting to load an assembly that, in previous versions of the CLR, would classify it as a partial trust assembly based on its evidence (e.g. its zone) according to CAS policy.
In CLR 4.0, CAS policy is totally deprecated and is not even enabled by default. Under the circumstances, though, it appears the CLR throws an Exception when what would be a partial trust load in CLR 2.0 is a full trust load in CLR 4.0.
The loadFromRemoteSources switch the Exception message refers to is in the runtime element under configuration and looks like this:
<runtime>
<loadFromRemoteSources enabled="true|false" />
</runtime>
This will not enable legacy CAS policy but will allow you (or, in this case, the build system) to load remote assemblies with the same permissions as the host AppDomain. In this case it seems as though you could modify the configuration for the build system (which I assume in this case would be Visual Studio: %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config) to enable this switch.
If you don't want to modify that configuration then you can set the environment variable COMPLUS_EnableLegacyCASPolicy to 1, which will enable CAS Policy that was present in CLR 2.0 and also allow Silverlight to load this task.
Hope that helps.
David, Blog - http://blogs.rev-net.com/ddewinter/ Twitter - #ddewinter
It should work if you add <loadFromRemoteSources enabled="true"/> to devenv.exe.config.
More info at http://msdn.microsoft.com/en-us/library/dd409252%28VS.100%29.aspx

Resources