Vs for Mac 8.1(build 2697) Xaml Preview not loading - xaml

VS for Mac updated today May 6, since then the Xamarin XAML preview isn't working for both platforms.
No errors, no information. Just endless blank loading screen.
Downgrading by changing to a 'stable channel' ensures no new xamarin forms project can even compile with the error:
/usr/local/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(5,5): Error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
System.TypeLoadException: Could not load type of field 'Microsoft.NET.Build.Tasks.DependencyContextBuilder:_filteredPackages' (12) due to: Could not resolve type with token 01000027 from typeref (expected class 'NuGet.Packaging.Core.PackageIdentity' in assembly 'NuGet.Packaging, Version=5.0.0.6,
Has someone found a workaround?

Yes, it is just the case for Xamarin Previewer,which is really problematic. And we apologize for the inconvenience.
The xamarin development team is doing their best to address this issue and we are urging them to release the latest version as soon as possible.
Of course, you can also try other alternate tools ,e.g. LiveXAML and Xamarin live reload
For more details, you can check:
https://www.livexaml.com/
https://marketplace.visualstudio.com/items?itemName=Xamarin.XamarinLiveReload

I solved the issue by removing the '2.2.203' folder in the 'sdk' folder leaving '2.1.505'.
The part to the folder is 'Macintosh HD⁩ ▸ ⁨usr⁩ ▸ ⁨local⁩ ▸ ⁨share⁩ ▸ ⁨dotnet⁩ ▸ ⁨sdk⁩'
Apparently VS for mac isnt smart enough to point back to the older netstandard after switching from preview to stable channel.

As stated yes the Xaml preview is broken.
However to fix the error you are getting with downgrading VS for Mac you need to install .Net SDK 2.2.107
I was getting the exact same error as you and finally this has fixed it and I can now compile Forms projects again.

Related

ColorSync framework missing on Sierra when building with Xcode 9

When building our macOS application on Sierra (10.12.6) with Xcode 9 (9A235), the application will not launch properly because of the ColorSync framework -- this can't be located by dyld:
Termination Reason: DYLD, [0x1] Library missing
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Library not loaded: /System/Library/Frameworks/ColorSync.framework/Versions/A/ColorSync
Referenced from: /Volumes/*/ColorSyncTest.app/Contents/MacOS/ColorSyncTest
Reason: image not found
Given that ColorSync.framework in the 10.13 SDK resides directly at /System/Library/Frameworks, instead of being a child of ApplicationServices.framework as it used to be, the error makes sense...
We've tried linking explicitly (both strongly and weakly) to both ColorSync and ApplicationServices -- to no avail.
The question is -- how are people using ColorSync in Xcode 9 on anything earlier than 10.13?
Any ideas would be very much appreciated.
Thanks,
D.
We've managed to fix the issue by changing the deployment target for the dynamic library which uses ColorSync - from 10.8 to 10.9. I don't know why this works exactly, if someone else does, please share.
The first place to look for answers to these sorts of problems are the Mac OS X Release Notes. You can also check the API Changes page.
It looks like you are building against the 10.13 SDK and running on 10.12, can you change your target [macOS Deployment Target] to 10.12 and see if the linkage clears up?

Can't run xctest on macOS app - couldn’t be loaded because it is damaged or missing necessary resources

Please do help me on this scenario. I saw several post related to this, but could not able to resolve the issue with my mac App without pods.
Project is several years old, developed in macOS(Objective C). Now I am trying with XCTest for unit testing. Using Xcode 7.3.1, I am not able to run tests classes.
This project is to create frame work. Project is working fine, only issue is with the testing. We are not supposed to do Pods or some other alternatives.
Console window shows below points:
xctest[35530:345970] The bundle “BaseLibTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. xctest[35530:345970]dlopen_preflight(/Users/12345678/Documents/Modify/Cocoa/Projects/BaseLib/build/Debug/BaseLibTests.xctest/Contents/MacOS/BaseLibTests): Library not loaded: #executable_path/../Frameworks/FreeTDS.framework/Versions/A/FreeTDS
Referenced from: /Users/12345678/Documents/Modify/Cocoa/Projects/BaseLib/build/Debug/BaseLib.framework/Versions/Current/BaseLib
Reason: no suitable image found. Did find:
/Library/Frameworks/FreeTDS.framework/Versions/A/FreeTDS: no matching architecture in universal wrapper)
Program ended with exit code: 82
#Anand For the 3rd Point: Please check the build settings.
Please make sure its either set to Standard Architectures (64-bit Intel) (x86_64) - $(ARCHS_STANDARD) or set to represent proper architectures.
To debug this more, could you please copy paste the exact error you are facing and share the build env variables?

Build failed. Could not find type 'System.Globalization.SortVersion'

Somewhere along the line in the last week, Xamarin on my Windows machine started giving the above mentioned error any time I compile with MONO.
Specifically occurs when Project|Active Runtime is MONO - never happens when runtime is Microsoft.NET.
I've tried uninstalling/reinstalling MONO runtime (mono-3.2.3-gtksharp-2.12.11-win32-0.exe)
Any clues? Google searches come up with pretty much nothing
I get the same error today, (after an update yesterday to 4.2.4 Build 35) There is a bugfix here
Build works fine on another PC without the latest update (4.2.3 build 59). I guess the answer is to roll back to 4.2.3.
You can get it from your account page at Xamarin.com >> Downloads >> View all versions.
The solution from here says that you should either uncheck the box "Use MsBuild" in project settings or use .NET for building but then run with Mono if you want to test runtime compatibility.

Using Novell.Directory.Ldap in Mono (For Android and Touch)

I want to use the Novell.Directory.Ldap library in a MonoTouch and Mono For Android project.
http://www.novell.com/coolsolutions/feature/11204.html
When I compile my project in iOS simulator modus, It compiles without errors and runs correctly (in the iOS simulator).
When I compile my project in iOS device modus (to test the app with a physical device), I get this error:
Error MT2002: Failed to resolve "System.Void System.Security.Cryptography.RNGCryptoServiceProvider::.ctor(System.Byte[])" reference from "mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" (MT2002) (MyProject)
How could I solve this problem? I can't find a solution.
Should this library work for MonoTouch and Mono For Android?
Are there better LDAP solutions for Mono?
UPDATE: I just tested it with Mono For Android. This works fine.
There's three questions in there, so I splitted my answers in three. Please read all of them :-)
How could I solve this problem?
This is a general problem with a general solution to solve it.
The code you compiled is including a reference to "mscorlib, Version=1.0.5000.0
That's likely because you did not use the compiler provided with Xamarin.iOS (MonoTouch), named smcs, to build the assembly. That compiler would set the references to use the right mscorlib.dll assembly (and report anything missing in the MOBILE profile).
The fact that it can work for Xamarin.Android is that it uses the JIT (just in time compilation), so missing members won't be found before runtime (and if execution reach that code).
OTOH Xamarin.iOS uses AOT (ahead of time compilation) since JIT'ing is not allowed (by Apple) on devices. That means missing members are found at build time. In this case the (managed) linker can't find the reference and issue the MT2002 error.
So the solution is to re-build the assembly using smcs and fix, if any, build time errors. E.g. IIRC that RNGCryptoServiceProvider ctor is not available (and does nothing since seeding is not possible) and should be replaced with the default ctor.
Should this library work for MonoTouch and Mono For Android?
It should. However my personal experience with Novell.Directory.Ldap was not really good (code and design issues, e.g. threading, in particular with SSL enabled).
Also the code has not been updated for quite a while. You might be better served at looking at (managed or native) alternatives for your LDAP needs.
Are there better LDAP solutions for Mono?
Sadly I have not used any other similar library so I can't suggest alternatives (but maybe other people will be able to help).
The problem is solved.
Instead of using the dll from Novell, I downloaded all the source files of the Novell LDAP library and put them into a new library project. Then I made a reference to that library from my own Mono project.
While compiling my project and the library project, I received some errors from the library project. After solving these errors manually, it works fine for both (MonoTouch and Mono for Android).

How can I fix a missing mscorelib.dll error that occurs when trying to run a Mono for Android app?

In MonoDevelop when compiling and running an app developed for Android against the simulator, the app compiles then crashes immediately in the simulator with the following application output...
E/mono ( 225): The assembly mscorlib.dll was not found or could not be loaded.
E/mono ( 225): It should have been installed in the `/home/jon/Development/xamarin/mono/BUILD/armeabi/install/lib/mono/2.0/mscorlib.dll' directory.
Keep in mind that I'm not Jon so I don't even know where it's getting the /home/jon path configuration. Though I have found that path in other similar but ultimately unrelated searches on the internet so I imagine it's a path on some other devs machine.
mscorlib.dll is indeed on my machine. located here...
/Developer/MonoTouch/usr/lib/mono/2.1/
and here...
/Developer/MonoAndroid/usr/lib/mono/2.1/
I've tried targetting various Android SDK environments (currently 2.3 and the simulator is currently running under the 2.3 SDK environment as well).
I'm on Mac OSx 10.7.2. Using the latest version of MonoDevelop, Mono and Mono for Android. I've also got the latest MonoTouch installed as well and iPhone apps compile fine if that's worth anything.
The closest thing I can find to a hint at the issue is here...
http://phonicuk.com/Forums/ViewThread.aspx?tid=401
I've tried reinstalling Mono and Mono for Android but admittedly have not tried uninstalling in entirely before a reinstall. I've searched within files for the /home/jon path thinking that it must be a configuration somewhere but haven't been able to find it anywhere.
I found this... Mono return error: mono mscorlib.dll was not found
Along with a few other things that were sort of in the same vein, but ultimately nothing that seems to be a fix.
Any ideas?
Update: From the suggestions in jonp's answer below it indeed seems like the Mono.Android.DebugRuntime package is not installed. So far I've tried a couple of MonoAndroid reinstalls and have tried removing MonoAndroid entirely beforehand. I'm trying to figure out if there is a way to add the package manually, but I'm so new to this.
Another update: Not sure why I didn't try this already, but I created a HelloWorld MonoAndroid app and it works fine. The compilation took a while longer too for that one and I could see if was setting up the required packages, so there has to be an issue with the specific solution.
When you install a Debug build of your app on the device, three .apk files are installed:
Mono.Android.DebugRuntime, which contains libmonosgen-2.0.so, mscorlib.dll, etc.
Mono.Android.Plaltform.ApiLevel_N, which contains Mono.Android.dll for API level N.
Your application.
My guess is that the Mono.Android.DebugRuntime package has not been installed. To check this, run:
adb shell pm list packages | grep Mono.Android
I'm going to guess that it's missing. :-)
Next, why is it missing? When you Run the app within MonoDevelop, all required packages are checked for and installed. It seems rather odd that it wouldn't be. Is your device low on disk space?
adb shell df /data
How are you launching the emulator? If you're launching within MonoDevelop, there should be enough free space to install all of the above packages. However, if you launch it yourself, the default /data size is 64MB, which isn't enough to support a Debug build environment. Please launch the simulator from MonoDevelop and re-Run your app, or launch the emulator so that it has enough free space:
emulator -partition-size 512 -avd YOUR_AVD_NAME