In Xamarin getting a failed to resolve System.Runtime.Serialization.XsdDataContractExporter - c#

I've got a cross platform Xamarin app. There's a PCL project, an Android project, and an iOS project. When I build the iOS portion, it complains that "MTOUCH" is having a problem.
Failed to resolve System.Runtime.Serialization.XsdDataContractExporter
reference from System.Runtime.Serialization ...
My Xamarin studio has recently updated to the latest iOS 9 code. Is that related? I also started to use some Newtonsoft.Json code, but I commented out all of the JSON code and it doesn't seem to help.
Any ideas where this error is coming from? I tried googling and I get nothing helpful.

I was having the same issue 2 days ago, but with Android and when I was deploying the application to Release.
Check a few things first:
Go to the Linker Options in the iOS Build properties. If you are in the DEBUG configuration try with the "Don't Link" option and check if it's working fine. In case of RELEASE the recommended option to use is "Link SDK assemblies only".
If the option one didn't work, you could force an specific assembly to be ignored by the Linker, indicating the following in the Additional mtouch arguments field:
-linkskip=System.Runtime
Here's another answer that could help you as well: https://stackoverflow.com/a/30059876/2188509
This is what I did for my Android RELEASE configuration, in case you have the same issues:
I hope this helps.
Regards

Related

Xamarin build ERROR : error APT0000: In <declare-styleable> ..., unable to find attribute

I received a project from another developer. I setup my machine. VS-2017 with the required components was already configured.
Android SDK-Manager has the corresponding version installed. Project is configured to compile with Android 7.1 (Nougat).
Starting the build I get one error
1>ERROR : error APT0000: In <declare-styleable> AppBarLayout, unable to find attribute android:keyboardNavigationCluster
It is unclear to me, were I need to set this information, or were this information is needed.
I rececked ERROR: In MenuView, unable to find attribute android:preserveIconSpacing
and Error:In SherlockSpinner, unable to find attribute android:popupPromptView. Both articles don't help.
I rechecked the SDK-Tools, I deleted the folder C:\Users\<user>\AppData\Local\Xamarin.
As far as I understand the message there is an attribute missing, that needs to be set.
In a project file Resource.designer.cs I found
public const int AppBarLayout_android_keyboardNavigationCluster = 2;
The name seams to match exactly.
Can someone explain me this error?
Can someone explain how I get rid of it and how to fix similar problems in future?
I had this error and after some research I just installed the Android OREO 8.0 SDK in the
Android SDK Manager and than I select Android Project > Properties > Application > Use latest Platform (Android 8.0 (Oreo)). And it worked for me.
I fixed it by setting the Target Android Version to API Level 26.
You have to update the target of your project, It seems that the solution was created with a higher target (Oreo API Level 26)
Thsi is what I did, I don't know what of the steps fixed the problems.
Uninstalled all Android SDKs with the SDK manager
Uninstalled the Xamarin components.
1.+2. Was done by uninstalling the App-Development features from VS-2017
Install Xamarin and current SDKs.
After this I was able to select "Use latest platform (Android 8.0 Oreo)" in the Android project section in the Solution.
This wasn't possible before. I just could select "Android 7.1 (Nougat)" and 8.0 didn't showed up (but was installed). Now the error is gone.
In my case I'd moved from Enterprise to Professional and found that there was a mismatch in the Xamarin options (Tools -> Options -> Xamarin) and the android SDK location needed to be changed to "C:\Users\YourMum\AppData\Local\Android\android-sdk".
Can't remember exactly what it was originally but think it was in Programs.

Windows App Certification Kit - Security Features error

I am working on a UWP app and I have come across a strange issue with windows app certification kit (WACK).
The app itself runs fine but when I test the app through the WACK it always fails the certification saying that /SomePackagePath/sni.dll failed AppContainerCheck. Also, the supported APIs test shows a long list of unsupported APIs that my app doesn't use but WACK thinks it does. I have no idea why does it do that.
I have created numerous packages and tried to fix code-behind where I thought things could be wrong but to no avail. I tried to search the error on internet and I found out that my app should enable the .Net native tool chain and I checked the project settings and it is already enabled.
The WACK also says something about some linker options that should be set but I have no idea how to set those linker options in VS 2017. I am using the latest VS 2017 with all updates. Any suggestions on what to do? Any help will be greatly appreciated.
I can provide further information if anyone needs it.
The WACK report has said clearly. The "sni.dll" called some APIs which are not supported in UWP. If the "sni.dll" was made by you, I suggested that you'd better check its source code. You could check .NET for UWP apps document to see if this dll calls some unsupported APIs. If this DLL isn't made by you, you could first remove it from your project and create a package to see if it will be able to pass the WACK. Then, you will know if this issue was due to this DLL.
Beside, you could debug your code to see if you will get some exception when enable the "Compile with .NET Native Tool chain" and "Optimize code".
I managed to find the culprit and it was related to Jint nuget package. Apparently it uses some APIs which are not allowed in the UWP system and that also sni.dll is part of this.

Error executing task XamlCTask- Xamarin

I am stucking with this error for several days:
/Upackages/Xamarin.Forms.2.3.3.175/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets:
Error: Error executing task XamlCTask:
Could not find file "/Users/XXXX/obj/Debug/XXXX.dll.mdb".
Firstly, I updated the xamarin.forms, but the error was appeared again to me. Then, I clean each project and build it again, but no change has happened.
So, I am wondering what can I do? It has just shown to me since some days ago, before I could compile my project easily.
I had the same issue but using Visual Studio for MAC.
Try doing the following:
Go to "Preferences"
Then look for .Net Runtimes.
I was using: Mono 5.*
I changed my default to Mono 4.* and I was able to build successfully.
NOTE: Make sure that all the packages for Xamarin.Forms are also the same version.

Xamarin iOS error: Can not resolve reference

If I set up a Xamarin.Forms Solution in VS 2013 and try to run the iOS Version, it fails because of the following error:
Error 2 Can not resolve reference: /Users/Koray/Library/Caches/Xamarin/mtbs/builds/WalkiOS/aae389efbebffd5cd3625dcf99aad02c/C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/Xamarin.iOS/v1.0/Facades/System.Collections.Concurrent.dll Walk.iOS
The Xamarin Build Host for Visual Studio is set up and a few weeks ago it worked fine.
I can't find anything to fix the error.
The solution is to update Xamarin on both machines to the same version. It should work fine if you do this.
This can happen if you include a library that's not part of Xamarin.iOS. For example, when you Alt-Enter with ReSharper and it auto-adds a reference it thinks will work, when actually, there's no iOS equivalent of it. This happened to me when I had ReSharper add System.Web. The error looked like System.EnterpriseServices.Wrapper, but the actual error was a non-Mono/non-iOS library being referenced by my project. Unfortunately, the error message is effectively wrong. I hope that helps!
Ybrin's answer is also true. I came across this SO article looking for a different answer, and ended up figuring out this alternative answer.

Monotouch 'mtouch failed with no output (137)' after updating to Apple SDK 4.3

I updated to iPhone SDK 4.3 today and now it's not possible to build/run (in debug or release mode) any of my projects that worked fine in iPhone SDK 4.2.
When I try to build or run Monodevelop "hangs" on "Compiling to native code"
If I try to run/debug to the iPhoneSimulator I get the error message:
"Error merging info.plist: Invalid
data"
Does anyone have a solution to this problem?
Explicitly target the 4.2 iOS SDK inside your project's options, under the iPhone Build section. When it is at the Default setting, it always targets the latest iOS version installed.
Upgrading to MonoTouch 3.2.5 will resolve this issue.
For an older version, you just need to create a symlink:
cd /Developer/MonoTouch/SDKs
sudo ln -s MonoTouch.iphonesimulator4.2.sdk MonoTouch.iphonesimulator4.3.sdk
No symlink is needed for the device SDK directory, as it does not contain a version number.
Upates are released to both MonoDevelop and MonoTouch that fix this problem. The updates are available through the update function in MonoDevelop
I had the same problem. It all started for me when I uninstalled/re-installed my dev environment in order to fix something else (breakpoints not being hit during debugging).
So, even though I re-staged my entire laptop in order to come to this conclusion, user653490 is correct, the update to MonoDevelop DOES fix the problem. However, what is NOT clear at first is the fact that the BUILD VERSION is very important. Whereas I was still seeing "Error merging info.plist: Invalid data" with MonoDevelop 2.4.2 build 20402000, once I was using build 2040200*4*, I was able to compile again. The build version is the key. Hope this helps someone else, because it was very frustrating.

Categories

Resources