Xamarin iOS Simulator error - xamarin.ios

When i make that call from iPhone Simulator (iOS 6)
var request = System.Net.HttpWebRequest.Create(url);
I have following error
An exception was thrown by the type initializer for System.Net.WebRequest
Error Initializing the configuration system.
Unrecognized configuration section <system.runtime.remoting>
/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/etc/mono/2.0/machine.config
Stacktrace
at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Net.WebRequest..cctor () [0x00000] in <filename unknown>:0
I doesn't undestand what i must do..
UPDATE
My project have a CORE where are referenced that libraries:
Newtnsoft.Json.dll System.Net.dll (from
/Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
System.Core.dll (from
/Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
System.Core.dll (from
/Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
System.Data.Linq.dll (from
/Library/Frameworks/Mono.framework/Libraries/mono/4.5/) System.dll
(from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
mscorlib.dll (from
/Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
Cirrious.MvvmCross.dll (vnext version)
My iOS Project link CORE Project and have that references:
monotouch
Cirrious.MvvmCross.dll (vnext version)
Cirrious.MvvmCross.Binding.dll (vnext version)
Cirrious.MvvmCross.Binding.Touch.dll (vnext version)
Newtnsoft.Json.dll
Cirrious.MvvmCross.Dialog.Touch.dll (vnext version)
Cirrious.MvvmCross.Plugin.DownloadCache.Touch.dll (vnext version)
Cirrious.MvvmCross.Plugin.File.Touch.dll (vnext version)
Cirrious.MvvmCross.Plugin.Location.Touch.dll (vnext version)
Cirrious.MvvmCross.Plugin.ThreadUtils.Touch.dll (vnext version)
CrossUI.Touch.dll (vnext version)
System.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
System.Windows.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)

System.Configuration is not part (neither as an assembly or namespace) of the BCL shipped with Xamarin.iOS.
If you get this error it's because you (somehow) got another System.dll (v2.0 from Mono or MS?) into the simulator and this won't work properly.
Make sure you're referencing only the BCL assemblies from Xamarin.iOS and the problem will go away.

Related

dotner core: Too many levels of symbolic links

I'm trying build the code of dotnet core on linux, but I've been receive the next error:
[limup#localhost salao]$ dotnet build
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 67.43 ms for /home/limup/Documents/Projetos/Limup/salao/salao.csproj.
/usr/share/dotnet/sdk/3.1.101/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets(99,5): error MSB6003: The specified task executable "dotnet" could not be run. System.ComponentModel.Win32Exception (40): Too many levels of symbolic links [/home/limup/Documents/Projetos/Limup/salao/salao.csproj]
/usr/share/dotnet/sdk/3.1.101/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets(99,5): error MSB6003: at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) [/home/limup/Documents/Projetos/Limup/salao/salao.csproj]
/usr/share/dotnet/sdk/3.1.101/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets(99,5): error MSB6003: at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) [/home/limup/Documents/Projetos/Limup/salao/salao.csproj]
/usr/share/dotnet/sdk/3.1.101/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets(99,5): error MSB6003: at System.Diagnostics.Process.Start() [/home/limup/Documents/Projetos/Limup/salao/salao.csproj]
/usr/share/dotnet/sdk/3.1.101/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets(99,5): error MSB6003: at Microsoft.Build.Utilities.ToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [/home/limup/Documents/Projetos/Limup/salao/salao.csproj]
/usr/share/dotnet/sdk/3.1.101/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets(99,5): error MSB6003: at Microsoft.AspNetCore.Razor.Tasks.DotNetToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [/home/limup/Documents/Projetos/Limup/salao/salao.csproj]
/usr/share/dotnet/sdk/3.1.101/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.CodeGeneration.targets(99,5): error MSB6003: at Microsoft.Build.Utilities.ToolTask.Execute() [/home/limup/Documents/Projetos/Limup/salao/salao.csproj]
Does anyone know how to resolve this error?
Environment Data
[limup#localhost salao]$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.101
Commit: b377529961
Runtime Environment:
OS Name: fedora
OS Version: 31
OS Platform: Linux
RID: fedora.31-x64
Base Path: /usr/share/dotnet/sdk/3.1.101/
Host (useful for support):
Version: 3.1.1
Commit: a1388f194c
.NET Core SDKs installed:
3.1.101 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
OBS
Tried Fixes put in dotnet restore, but I received the same error.
Did not have this problem with dotnet sdk 2.0.

Azure Functions Not Generating extensions.json

I have an Azure Functions Project with multiple functions, triggered by ServiceBus and BlobStorage.
They have been building and deploying to azure fine for a couple months now.
Something happened recently and they are no longer deploying from my build machine with an error in Azure when you click on the function Error: The binding type(s) 'blobTrigger' are not registered.
It is still deploying fine from my dev machine though. They are using WEBSITE_RUN_FROM_ZIP to deploy the code itself.
I pulled the publish directory from both my dev machine and the build machine and it appears that the file extensions.json is getting generated locally but is not on the build machine, along with empty localization folders that don't exist on the build machine and about 10mb difference in size that I can't account for yet.
The Azure Functions are targeting .Net Standard 2.0. Checking the .Net versions, .Net core is the same version across the build and dev machines.
What causes this file to get generated?
One of the possible reasons could be an update to Azure Functions v2.0
That could explain sudden change causing errors for functions that as you mention were working till a couple of months ago.
Take a look at this issue
https://github.com/Azure/azure-functions-host/issues/3363#issuecomment-417926456
it's very similar to yours.
One of the changes in v2.0 is that you need to reference the storage extensions when working with storage related triggers
Reference the Storage Extension where appropriate If you have functions that work with Azure Storage (queue/tables/blob) either with
triggers, input bindings or output bindings, you'll need to reference
the new Microsoft.Azure.WebJobs.Extensions.Storage extension.
Here is a link that documents all the breaking changes -
Azure Functions Runtime 2.0.12050-alpha breaking changes notice
I have been able to work around the issue by following the advice in this Github comment.
Essentially sometimes you have to include an extra dependency to get msbuild/visual studio to run the post build steps and generate your extensions file.
Add Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator as a dependency to your functions project and it should always (so far) build your publish directory properly.
Per usual, leaving the question open for someone to tell us why this is needed.
The best way to find out why it is not working is to turn on the diagnostic logs in Visual Studio then build.
Then, after you build, you can search for the word "extensions.json"
Which will start like this:
2> Task "GenerateFunctionsExtensionsMetadata"
2> Task Parameter:SourcePath=F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin
2> Task Parameter:OutputPath=F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin
2> Extensions generator working directory: 'C:\Users\jsgou\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.1.8\tools\net46\..\netstandard2.0\generator'
2> Extensions generator path: 'dotnet'
2> Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.Console.dll "F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin" "F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin\extensions.json"
Then, a little further you might find the actual error why it is not working:
2> HBTI.ServiceTech.AzureFunctions.dll
2> Resolving assembly: 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
2> Assembly 'System.Runtime' loaded.
2> Resolving assembly: 'Microsoft.Azure.Functions.Extensions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f655f4c90a0eae19'
2> Assembly 'Microsoft.Azure.Functions.Extensions' loaded from 'F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin\Microsoft.Azure.Functions.Extensions.dll'.
2> Resolving assembly: 'Microsoft.Azure.WebJobs.Host, Version=3.0.18.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
2> Assembly 'Microsoft.Azure.WebJobs.Host' loaded from 'F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin\Microsoft.Azure.WebJobs.Host.dll'.
2> Resolving assembly: 'Microsoft.AspNetCore.Mvc.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
2> Resolving assembly: 'Microsoft.AspNetCore.Mvc.Core, Culture=neutral, PublicKeyToken=null'
2> Cannot load 'Microsoft.AspNetCore.Mvc.Core'. Aborting assembly resolution.
2> Unable to find fallback for assembly 'Microsoft.AspNetCore.Mvc.Core'. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Core, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
2> File name: 'Microsoft.AspNetCore.Mvc.Core, Culture=neutral, PublicKeyToken=null'
2> at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
2> at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
2> at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, StackCrawlMark& stackMark, IntPtr pPrivHostBinder)
2> at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, StackCrawlMark& stackMark)
2> at System.Reflection.Assembly.Load(String assemblyString)
2> at ExtensionsMetadataGenerator.Console.Program.AssemblyLoader.<>c__DisplayClass1_0.<Initialize>b__0(Object sender, ResolveEventArgs args) in d:\a\1\s\tools\ExtensionsMetadataGenerator\src\ExtensionsMetadataGenerator.Console\Program.cs:line 78
2>
2>
2> Could not evaluate 'HBTI.ServiceTech.AzureFunctions.dll' for extension metadata. If this assembly contains a Functions extension, ensure that all dependent assemblies exist in 'F:\git\clients\hbti\Portal\hbti-web-master\HBTI.ServiceTech.AzureFunctions\bin\Debug\netcoreapp3.1\bin'. If this assembly does not contain any Functions extensions, this message can be ignored. Exception message: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
My solution in this case, is to simply make my own extensions.json and drop it in the bin foler as such:

.NET Standard 2.0 Xamarin.iOS project VSTS build issue

Currently I'm trying to upgrade a Xamarin.Forms project to use .NET Standard 2.0. This went fine for Android but I'm getting stuck with the iOS version. To build iOS we use a On-Primise MacMini as build agent int VSTS. Now I'm getting the error below when building the solution.
=================================
.... way more erros like below ...
2017-11-21T11:39:43.8920830Z ViewModels/DashboardViewModel.cs(66,35): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj]
2017-11-21T11:39:43.9014700Z ViewModels/DashboardViewModel.cs(66,73): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj]
2017-11-21T11:39:43.9036150Z ViewModels/DashboardViewModel.cs(66,93): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj]
2017-11-21T11:39:43.9053280Z
2017-11-21T11:39:43.9083060Z 6 Warning(s)
2017-11-21T11:39:43.9107960Z 47 Error(s)
2017-11-21T11:39:43.9116100Z
2017-11-21T11:39:43.9131830Z Time Elapsed 00:00:59.23
2017-11-21T11:39:43.9327960Z ##[error]Xamarin.iOS task failed with error Error: /Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild failed with return code: 1. For guidance on setting up the build definition, see https://go.microsoft.com/fwlink/?LinkId=760847.
2017-11-21T11:39:43.9575950Z [command]/usr/bin/security delete-keychain /Users/Admin/BuildAgent/_work/3/s/_xamariniostasktmp.keychain
2017-11-21T11:39:44.2658340Z ##[section]Finishing: Build Xamarin.iOS solution xxx.sln
=================================
This output comes from the following build definition:
Now I've searched the internet and found a view possible solutions:
Update Visual Studio on the MacMini
Update XCode on the MacMini
Install .NET Core 2.x SDK on the MacMini
Add .NET Standard 2.x NuGet package to Xamarin.IOS project
Add .NET Standard Library NuGet pre-release package to Xamarin.iOS project (not possible)
Manually reference netstandard.dll to the Xamarin.iOS project
Remove install argument (not using it)
But all of this was not enough to fix the issue. Now I'm not a expert in using a Mac. Actually I never touched one before this issue... So I might have done something wrong here...
But I've been able to get some version information about all products on the MacMini:
========= Visual Studio =========
Visual Studio Community 2017 for Mac
Version 7.2.2 (build 11)
Installation UUID: b43353ef-651c-468b-8b7d-3f1714586419
Runtime:
Mono 5.4.1.6 (2017-06/1f4613aa1ac) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 504010006
NuGet
Version: 4.3.1.4445
.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.0.3
SDK: /usr/local/share/dotnet/sdk/2.0.3/Sdks
SDK Version: 2.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Sdks
Xamarin.Profiler
Version: 1.5.6
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Xamarin.Android
Not Installed
Xamarin Inspector
Not Installed
Apple Developer Tools
Xcode 9.1 (13532)
Build 9B55
Xamarin.iOS
Version: 11.3.0.47 (Visual Studio Community)
Hash: 51128b8c
Branch: xcode9.1
Build date: 2017-10-31 22:42:13-0400
Xamarin.Mac
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
Build Information
Release ID: 702020011
Git revision: b604c37c5a4a2f0919b45ffbe2aaad9fe040af31
Build date: 2017-11-01 08:31:43-04
Xamarin addins: d57dc14cbd4eb166ee62bab585965ab78d3650bc
Build lane: monodevelop-lion-d15-4
Operating System
Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
Wed Oct 4 00:17:00 PDT 2017
root:xnu-3789.71.6~1/RELEASE_X86_64 x86_64
============= XCode =============
XCode for Mac
Version 9.1 (9B55)
============= Mono ==============
Mono JIT compiler version 5.4.1.6 (2017-06/1f4613aa1ac Wed Oct 18 09:31:57 EDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: altstack
Notification: kqueue
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: yes(3.6.0svn-mono-master/8b1520c8aae)
GC: sgen (concurrent by default)
========= .NET Core SDK =========
.NET Core SDK
Version 2.0.3
=================================
The project can be build on the MacMini itself. Only the VSTS task keeps failing...
Does someone have any idea's left which can help me solve my issue?
Kind regards,
Jop
Everything started to work fine after we manually edited the .NET Standard 2.0 project file (*.csproj) and add a PackageReference by hand.
<ItemGroup>
...
<PackageReference Include="NETStandard.Library" version="2.0.0" />
...
</ItemGroup>

Monotouch - Failed to resolve ExtensionAttribute

Using Xcode 5.0.1 with Xamarin studio Version 4.0.13 (build 38) and Xamarin.iOS
Version: 6.2.4.2
I am getting this error when trying to compile my project:
error MT2002: Failed to resolve "System.Void System.Runtime.CompilerServices.ExtensionAttribute::.ctor()" reference from "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
How can I solve it?
The reason for this error is that between .NET 2.0 (including Silverlight) and 4.0 the [Extension] attribute moved from System.Core.dll to mscorlib.dll.
Xamarin.iOS 6.2 (and earlier) were based on a superset of Silverlight (aka the 2.1 profile). So the [Extension] attribute was located in System.Core.dll.
Since Xamarin.iOS 6.3+ the product was re-based on Mono 3.0 and the profile was updated to use the newer 4.0/4.5 profile. Now the [Extension] attribute is located in mscorlib.dll.
In your case you had a binary assembly compiled against the newer (4.0) profile. That assembly had a reference to mscorlib, Version=4.0.0.0, ... to find [Extension] and would lead to errors if built against the older Xamarin.iOS (6.2 and earlier).
As you found out the easy solution was to update to the latest Xamarin.iOS release. Another way to solve this (without updating Xamarin.iOS) would have been to rebuild (if you have the source) the binary assemblies of your project against the assemblies (BCL) shipped with Xamarin.iOS 6.2.

Error finding Mono for Android SDK when compiling MonoTouch app using mdtool

I am trying to compile a monotouch application from the command line as part of an automated build. When I run the following command:
/Applications/MonoDevelop.app/Contents/MacOS/mdtool -v build "--configuration:Debug:iPhone --project:App.Project" /Users/james/Development/App/App.sln
I get the output:
MonoDevelop Build Tool
ERROR [2012-10-03 18:03:33Z]: ANDROID: Error finding Mono for Android SDK
System.ArgumentNullException: Argument cannot be null.
Parameter name: path1
at System.IO.Path.Combine (System.String path1, System.String path2) [0x00000] in <filename unknown>:0
at Xamarin.AndroidTools.MonoDroidSdkUnix.FindFramework (System.String sdk) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/md-addins/MonoDevelop.MonoDroid/external/androidtools/Xamarin.AndroidTools/Sdks/MonoDroidSdkUnix.cs:51
at Xamarin.AndroidTools.MonoDroidSdkBase.Initialize (System.String mfaSdkPath, System.String mfaFrameworkPath) [0x0000e] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/md-addins/MonoDevelop.MonoDroid/external/androidtools/Xamarin.AndroidTools/Sdks/MonoDroidSdkBase.cs:56
at Xamarin.AndroidTools.MonoDroidSdk.Refresh (System.String mfaSdkPath, System.String mfaFrameworkPath) [0x00037] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/ea010826/source/md-addins/MonoDevelop.MonoDroid/external/androidtools/Xamarin.AndroidTools/MonoDroidSdk.cs:120
Loading solution: /Users/james/Development/App/App.sln
Loading solution: /Users/james/Development/App/App.sln
Loading projects ..
Any thoughts on how to get mdtool to compile using MonoTouch rather than MonoDroid?
Additional configuration info:
MonoDevelop 3.0.4.7
Runtime:
Mono 2.10.9 (tarball)
GTK 2.24.10
GTK# (2.12.0.0)
Package version: 210090011
Apple Developer Tools:
Xcode 4.5 (1839)
Build 4G182
Monotouch: 6.0.3
Mono for Android: Not Installed
You can ignore this error. It always happens, but when you build from within MonoDevelop you don't see it.

Resources