F# Dictionary of Options - dictionary

Why can't I add None to a System.Collections.Generic.Dictionary of Option? Is it an expected behavior or a bug in Mono?
F# Interactive for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License
For help type #help;;
> open System.Collections.Generic;;
> let d1 = new Dictionary<int option, int>();;
val d1 : Dictionary<int option,int> = dict []
> d1.Add(None, 1);;
System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.ThrowHelper.ThrowArgumentNullException (ExceptionArgument argument) in <filename unknown>:line 0
at System.Collections.Generic.Dictionary`2[TKey,TValue].Insert (System.Collections.Generic.TKey key, System.Collections.Generic.TValue value, Boolean add) in <filename unknown>:line 0
at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (System.Collections.Generic.TKey key, System.Collections.Generic.TValue value) in <filename unknown>:line 0
at <StartupCode$FSI_0004>.$FSI_0004.main# () in <filename unknown>:line 0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) in <filename unknown>:line 0
Stopped due to error
> d1.Add(Some 10, 1);;
val it : unit = ()
I'm using Mono on OS X.
$ mono --version
Mono JIT compiler version 4.2.0 (Stable 4.2.0.179/a224653 Tue Oct 6 11:28:25 PDT 2015)
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: supported, not enabled.
GC: sgen

Its not a bug. Option<'T> uses the attribute [CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue) which causes None to be represented as null.
So you actually are adding a null as a key to a Dictionary which as you know is not allowed.
For reference:
UseNullAsTrueValue:
Permit the use of null as a representation for nullary discriminators in a discriminated union.
More information here Why is None represented as null?

Related

Xamarin.iOS app fails to compile in Visual Studio for Mac 8.10.14

I have the following error when compiling an Xamarin iOS app in Visual Studio for Mac 8.10.14 when doing it in Release Mode to Generic Device:
MTOUCH : error : System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.CollectionBase.System.Collections.IList.get_Item (System.Int32 index) [0x0000d] in <92218043474744ea9d64d27064c35dcb>:0
at Mono.Cecil.GenericParameterCollection.get_Item (System.Int32 index) [0x00006] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.ReflectionReader.GetTypeRefFromSig (Mono.Cecil.Signatures.SigType t, Mono.Cecil.GenericContext context) [0x002ee] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.ReflectionReader.GetGenericArg (Mono.Cecil.Signatures.GenericArg arg, Mono.Cecil.GenericContext context) [0x00000] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.ReflectionReader.GetTypeRefFromSig (Mono.Cecil.Signatures.SigType t, Mono.Cecil.GenericContext context) [0x003aa] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.ReflectionReader.CreateTypeSpecFromSig (Mono.Cecil.Signatures.TypeSpec ts, System.Int32 index, Mono.Cecil.GenericContext context) [0x00000] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.ReflectionReader.GetTypeSpecAt (System.UInt32 rid, Mono.Cecil.GenericContext context) [0x00049] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.ReflectionReader.GetTypeDefOrRef (Mono.Cecil.Metadata.MetadataToken token, Mono.Cecil.GenericContext context) [0x00051] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.ReflectionReader.GetMemberRefAt (System.UInt32 rid, Mono.Cecil.GenericContext context) [0x000a1] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.Cil.CodeReader.ReadCilBody (Mono.Cecil.Cil.MethodBody body, System.IO.BinaryReader br) [0x00430] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.Cil.CodeReader.VisitMethodBody (Mono.Cecil.Cil.MethodBody body) [0x000c0] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.MethodDefinition.LoadBody () [0x00058] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.Cecil.ModuleDefinition.FullLoad () [0x00047] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.CilStripper.AssemblyStripper.FullLoad () [0x0000b] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.CilStripper.AssemblyStripper.Strip () [0x00000] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.CilStripper.AssemblyStripper.StripAssembly (Mono.Cecil.AssemblyDefinition assembly, System.String file) [0x00016] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.CilStripper.Program.StripAssembly (Mono.Cecil.AssemblyDefinition assembly, System.String output) [0x00000] in <af3d3de500394ed18df77e27b5623689>:0
at Mono.CilStripper.Program.Main (System.String[] arguments) [0x00064] in <af3d3de500394ed18df77e27b5623689>:0
MTOUCH : error MT1009: Could not copy the assembly '/Users/.../Documents/repo/test/test/test.iOS/obj/iPhone/Release/mtouch-cache/3-Build/test.dll' to '/Users/.../Documents/repo/test/test/test.iOS/bin/iPhone/Release/test.iOS.app/test.dll': Could not strip assembly `/Users/.../Documents/repo/test/test/test.iOS/obj/iPhone/Release/mtouch-cache/3-Build/test.dll`.
Could not strip assembly `/Users/.../Documents/repo/test/test/test.iOS/obj/iPhone/Release/mtouch-cache/3-Build/test.dll`.
Could not strip assembly `/Users/.../Documents/repo/test/test/test.iOS/obj/iPhone/Release/mtouch-cache/3-Build/test.dll`.
It seems a problem with mono sdk, but I can't figured out how to fix this...
My current Visual Studio for Mac installation is:
Visual Studio Community 2019 for Mac
Version 8.10.14 (build 17)
Installation UUID: 18219619-f9f8-414d-9e88-cd653673a349
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
Package version: 612000140
Mono Framework MDK
Runtime:
Mono 6.12.0.140 (2020-02/51d876a041e) (64-bit)
Package version: 612000140
Apple Developer Tools
Xcode 13.1 (19466)
Build 13A1030d
Xamarin.iOS
Version: 15.2.0.17 (Visual Studio Community)
Hash: 738fde344
Branch: xcode13.1
Build date: 2021-11-09 02:45:16-0500
Operating System
Mac OS X 12.0.1
Darwin 21.1.0 Darwin Kernel Version 21.1.0
Wed Oct 13 17:33:24 PDT 2021
root:xnu-8019.41.5~1/RELEASE_ARM64_T8101 x86_64
Thanks in advance.

EF Core with SQLite on Mono: e_sqlite3 not found

We are using Entity Framework Core 2.2.4 together with an SQLite database targeting .NET Framework 4.7.2. Following Nuget packages were installed:
Microsoft.Data.Sqlite
Microsoft.EntityFrameworkCore.Sqlite
Microsoft.EntityFrameworkCore.Tools
On my development machine (Windows 10) everything works fine but when trying to run the application with Mono on our 32-bit Linux machine, the following exception occurs:
FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type
initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception.
---> System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. ---> System.DllNotFoundException: e_sqlite3
at (wrapper managed-to-native)
SQLitePCL.SQLite3Provider_e_sqlite3+NativeMethods.sqlite3_libversion_number()
at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number () [0x00000] in <61bb3ca1db9c41ea88f280f0b1600d58>:0
at SQLitePCL.raw.SetProvider (SQLitePCL.ISQLite3Provider imp) [0x00008] in <3d4b21fb9c764efbb11f6e3b02efff52>:0
at SQLitePCL.Batteries_V2.Init () [0x00005] in <f5d9c86a14864b5d99b8bdece1b8292c>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <a89b9d7c1a66468eb33312af7ed3a74e>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <a89b9d7c1a66468eb33312af7ed3a74e>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <a89b9d7c1a66468eb33312af7ed3a74e>:0
at Microsoft.Data.Sqlite.Utilities.BundleInitializer.Initialize () [0x0002f] in <b46e232ade014524baa458345f270c50>:0
at Microsoft.Data.Sqlite.SqliteConnection..cctor () [0x00000] in <b46e232ade014524baa458345f270c50>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteRelationalConnection.CreateDbConnection () [0x00006] in <74192050a4d342039620dc7ef6678f71>:0
at Microsoft.EntityFrameworkCore.Internal.LazyRef`1[T].get_Value () [0x00008] in <adf771f92e754fe1bb85c5850cd0c16b>:0
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection () [0x00000] in <69f795dffc844780bfcfff4ff8415a92>:0
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open (System.Boolean errorsExpected) [0x00000] in <69f795dffc844780bfcfff4ff8415a92>:0
at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteRelationalConnection.Open (System.Boolean errorsExpected) [0x00000] in <74192050a4d342039620dc7ef6678f71>:0
at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteDatabaseCreator.Exists () [0x0000c] in <74192050a4d342039620dc7ef6678f71>:0
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists () [0x0000b] in <69f795dffc844780bfcfff4ff8415a92>:0
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate (System.String targetMigration) [0x00012] in <69f795dffc844780bfcfff4ff8415a92>:0
at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate (Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade) [0x00010] in <69f795dffc844780bfcfff4ff8415a92>:0
at TestEfCorePlusSqlite.Program.Main (System.String[] args) [0x0000e] in <c4fad569c9a241ef887b5b2ddbc0225f>:0
Since the application is built with Any CPU configuration, x86 and x64 folders are created in bin/Debug, both containing an e_sqlite3.dll. I already tried to copy the x86 dll to bin/Debug but the error still occurred.
What I've tried so far:
installing Microsoft.EntityFrameworkCore.Sqlite.Core together with
SQLitePCLRaw.bundle_e_sqlite3 as suggested here
installing Microsoft.EntityFrameworkCore.Sqlite (or
Microsoft.Data.Sqlite or SQLitePCLRaw.bundle_green) as suggested here
different combinations of SQLitePCLRaw.* packages
What do I have to do to get EF Core and SQlite running on Mono?
After a refreshing weekend I took another glance at the problem. I found the official Mono documentation regarding DllNotFoundException and used MONO_LOG_LEVEL=debug mono YourApp.exe to find out which lib Mono is trying to load. It was /usr/lib/libe_sqlite3.so which was not available on my system. All I did was to copy the available /usr/lib/libsqlite3.so and rename it to libe_sqlite3.so. I'm not sure if this is the preferred way but my application works.

dnx kestrel "System.EntryPointNotFoundException: uv_loop_size"

I'm trying to run an unmodified Web Api application created by yo aspnet.
I'm getting this error:
System.EntryPointNotFoundException: uv_loop_size
at (wrapper managed-to-native) Microsoft.AspNet.Server.Kestrel.Networking.Libuv+NativeDarwinMonoMethods:uv_loop_size ()
at Microsoft.AspNet.Server.Kestrel.Networking.Libuv.loop_size () <0x42615b8 + 0x00014> in <filename unknown>:0
at Microsoft.AspNet.Server.Kestrel.Networking.UvLoopHandle.Init (Microsoft.AspNet.Server.Kestrel.Networking.Libuv uv) <0x4261528 + 0x0002b> in <filename unknown>:0
at Microsoft.AspNet.Server.Kestrel.KestrelThread.ThreadStart (System.Object parameter) <0x4261160 + 0x0005f> in <filename unknown>:0
Any ideas?
dnvm list output:
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-rc1-final coreclr x64 darwin
1.0.0-rc1-final mono linux/osx
* 1.0.0-rc2-16177 mono linux/osx default
mono version
Mono JIT compiler version 4.2.1 (explicit/6dd2d0d Tue Nov 10 18:01:18 EST 2015)
Update
I ran
export DYLD_FALLBACK_LIBRARY_PATH=/Users/Andy/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/
which ended up giving me a different error when running dnx web:
System.DllNotFoundException: libc.dylib
at (wrapper managed-to-native) System.IO.KeventWatcher:kqueue ()
at System.IO.KeventWatcher.GetInstance (IFileWatcher& watcher) <0x105a29310 + 0x000f3> in <filename unknown>:0
at System.IO.FileSystemWatcher.InitWatcher () <0x105a28fa0 + 0x0012c> in <filename unknown>:0
at System.IO.FileSystemWatcher..ctor (System.String path, System.String filter) <0x105a28d00 + 0x00114> in <filename unknown>:0
at System.IO.FileSystemWatcher..ctor (System.String path) <0x105a28cc0 + 0x00023> in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.FileSystemWatcher:.ctor (string)
at Microsoft.AspNet.FileProviders.PhysicalFilesWatcher..ctor (System.String root) <0x105a285b0 + 0x00154> in <filename unknown>:0
at Microsoft.AspNet.FileProviders.PhysicalFileProvider..ctor (System.String root) <0x105a282d0 + 0x000e4> in <filename unknown>:0
at Microsoft.AspNet.Hosting.HostingEnvironmentExtensions.Initialize (IHostingEnvironment hostingEnvironment, System.String applicationBasePath, IConfiguration config) <0x105a27f20 + 0x001ea> in <filename unknown>:0
at Microsoft.AspNet.Hosting.WebHostBuilder.Build () <0x105a1a860 + 0x000b8> in <filename unknown>:0
at Microsoft.AspNet.Hosting.WebApplication.Run (System.Type startupType, System.String[] args) <0x105560990 + 0x00216> in <filename unknown>:0
at Microsoft.AspNet.Hosting.WebApplication.Run (System.String[] args) <0x10555fef0 + 0x0001a> in <filename unknown>:0
at Microsoft.AspNet.Hosting.Program.Main (System.String[] args) <0x10555fec0 + 0x00014> in <filename unknown>:0
at Microsoft.AspNet.Server.Kestrel.Program.Main (System.String[] args) <0x10555fc90 + 0x000b5> in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x1050027a0 + 0x000b7> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () in <filename unknown>:line 0
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) in <filename unknown>:line 0
at Microsoft.Dnx.ApplicationHost.Program+<>c__DisplayClass3_0.<ExecuteMain>b__0 () in <filename unknown>:line 0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () in <filename unknown>:line 0
at System.Threading.Tasks.Task.Execute () in <filename unknown>:line 0
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at System.IO.FileSystemWatcher.Stop () in <filename unknown>:line 0
at System.IO.FileSystemWatcher.Finalize () in <filename unknown>:line 0
FYI: This is not mono related
It is not finding the libuv native library via the System.Net.Libuv assembly:
https://github.com/dotnet/corefxlab/blob/d76ebe8ab5ed058d3d6903939ab0e4ee4e19b773/src/System.Net.Libuv/src/System/Net/Libuv/Interop.cs
1st) Run dnvm list -detailed to determine the location of dnx runtimes that you are using, i.e.
Active Version Runtime Architecture OperatingSystem Alias Location
------ ------- ------- ------------ --------------- ----- --------
1.0.0-beta8 mono linux/osx ~/.dnx/runtimes
1.0.0-rc1-final mono linux/osx ~/.dnx/runtimes
* 1.0.0-rc2-16177 mono linux/osx default ~/.dnx/runtimes
2nd) My dnx installs are $HOME/.dnx/runtime (the default), so I can run find ~/.dnx/packages -name "libuv*"
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/osx/native/libuv.dylib
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/win10-arm/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/win7-x64/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/win7-x86/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/libuv.dylib
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/win10-arm/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/win7-x64/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/win7-x86/native/libuv.dll
Once you find where your libuv.dylib does live on your system, you can set the env. var DYLD_FALLBACK_LIBRARY_PATH to that directory:
export DYLD_FALLBACK_LIBRARY_PATH=/your/libuv/directory/location:$DYLD_FALLBACK_LIBRARY_PATH
Run your dmvm cmd again:
dnvm exec 1.0.0-rc2-16177 dnx web
Note:
On OS-X libuv is also available via brew # stable version 1.7.5 but I have not tried it as MS is not versioning their libuv.dylib build so I am not sure if it is a custom version or not ...(?)
otool -L /Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/libuv.dylib
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/libuv.dylib:
/Users/asplab/Documents/buildAgent/temp/buildTmp/fs-poll-5b0daf.out (compatibility version 0.0.0, current version 0.0.0)
After many reinstalls of Mono, Visual Code, Xamarin Studio, DNX, libuv, an upgrade of Node and RoberN giving me some clear pointers, I figured I should check my PATH env variable.
Sure enough, as soon as I added /usr/lib/:/usr/local/lib to my PATH, it all started working!
dnx web
Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
Success!
In case anyone comes here looking for another solution...
I tried all of the above, including multiple re-installs of everything and PATH updates without success, and finally switched to CoreCLR as per the solution here and it finally worked!
dnvm install 1.0.0-rc1-update1 -r coreclr -arch x64
dnvm use 1.0.0-rc1-update1 -r coreclr -arch x64
dnvm list
then, go to your project and try it again
dnx web

DNU Restore Unknown Header on OSX Yosemite

I've tried a couple of times to get .Net running on my MacBook using instructions found on the official Asp.Net docs and elsewhere. The latest attempt was using the Yeoman generator instructions found here.
However when I try to run DNU Restore, I am always presented with the same error, albeit for a different library. The error is "unknown header: " followed by a number that differs depending on the library. Here is one example (only the first few and last few lines included for brevity):
Error: DownloadPackageAsync: https://www.nuget.org/api/v2/package/Microsoft.AspNet.Loader.IIS/1.0.0-beta5
Unknown header: 3649249205
----------
System.NotSupportedException: Unknown header: 3649249205
at SharpCompress.Common.Zip.ZipHeaderFactory.ReadHeader (UInt32 headerBytes, System.IO.BinaryReader reader) [0x00000] in <filename unknown>:0
at SharpCompress.Common.Zip.SeekableZipHeaderFactory+<ReadSeekableHeader>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at SharpCompress.Archive.Zip.ZipArchive+<LoadEntries>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at SharpCompress.LazyReadOnlyCollection`1+LazyLoader[SharpCompress.Archive.Zip.ZipArchiveEntry].MoveNext () [0x00000] in <filename unknown>:0
at System.IO.Compression.ZipArchive.CreateZip (System.IO.Stream stream, ZipArchiveMode mode) [0x00000] in <filename unknown>:0
at System.IO.Compression.ZipArchive..ctor (System.IO.Stream stream, ZipArchiveMode mode, Boolean leaveOpen) [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.Restore.NuGet.PackageUtilities.EnsureValidPackageContents (System.IO.Stream stream, Microsoft.Framework.PackageManager.PackageInfo package) [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.Restore.NuGet.PackageUtilities+<>c__DisplayClass1_0.<OpenNupkgStreamAsync>b__0 (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.Restore.NuGet.HttpSource+<GetAsync>d__8.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.Restore.NuGet.PackageUtilities+<OpenNupkgStreamAsync>d__1.MoveNext () [0x00000] in <filename unknown>:0
...
Restore failed
Unknown header: 3649249205
NuGet Config files used:
/Users/jamie.morris/.config/NuGet/NuGet.Config
Feeds used:
https://www.myget.org/F/aspnetvnext/api/v2/
https://nuget.org/api/v2/
I've tried deleting the contents of ~/.dnx/packages and removing old versions of dnx from ~/.dnx/runtimes. At present I am using the 1.0.0-beta6-12170 runtime.
Has anyone else had a similar problem or figured out how to fix it?
EDIT:
Here is the output of dnvm list:
Active Version Runtime Arch Location Alias
------ ------- ------- ---- -------- -----
* 1.0.0-beta6-12170 mono ~/.dnx/runtimes default
Here is the output of mono --version:
Mono JIT compiler version 3.12.1 (tarball Tue Mar 17 15:03:14 GMT 2015)
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: supported, not enabled.
GC: sgen
Upgrade to Mono 4.0.1 or greater.

Invalid IL code in System.Drawing.ColorConverter:.ctor (): method body is empty

I am Japanese developer,so English is a strange sorry. I am deploying an asp.net web project to a Mono linux box. I had the skeleton working pretty nice, but when I started Building in , I got the error you see above.
I've set the dll to copy local and added it to the bin_System.Drawing.dll and bin_System.Drowing.Design.dll folder, with no success.
It seems like I'm missing something simple. Any guesses what it is?
Server Error in '/' Application
Invalid IL code in System.Drawing.ColorConverter:.ctor (): method body is empty.
Description: HTTP 500. Error processing request.
Stack Trace:
System.InvalidProgramException: Invalid IL code in System.Drawing.ColorConverter:.ctor (): method body is empty.
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

Resources