System.IO.EndOfStreamException when building with latest DNVM and Mono 4.0.1
Running into a System.IO.EndOfStreamException when building the latest sample ConsoleApp using the latest DNVM and the recently released Mono 4.0.1.
Miguels-MBP:~ miguellira$ dnvm list
Active Version Runtime Arch Location Alias
------ ------- ------- ---- -------- -----
* 1.0.0-beta5-11649 mono ~/.dnx/runtimes default
Mono JIT compiler version 4.0.1 (tarball Mon Apr 27 01:00:48 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
Miguels-MBP:ConsoleApp miguellira$ dnu build
Building ConsoleApp for DNX,Version=v4.5.1
Using Project dependency ConsoleApp 1.0.0
Source: /Users/miguellira/Downloads/Home-dev/samples/latest/ConsoleApp/project.json
Using Assembly dependency framework/mscorlib 4.0.0.0
Source: /usr/local/Cellar/mono/4.0.1/lib/mono/4.5/mscorlib.dll
Using Assembly dependency framework/System 4.0.0.0
Source: /usr/local/Cellar/mono/4.0.1/lib/mono/4.5/System.dll
Using Assembly dependency framework/System.Core 4.0.0.0
Source: /usr/local/Cellar/mono/4.0.1/lib/mono/4.5/System.Core.dll
Using Assembly dependency framework/Microsoft.CSharp 4.0.0.0
Source: /usr/local/Cellar/mono/4.0.1/lib/mono/4.5/Microsoft.CSharp.dll
System.IO.EndOfStreamException: Failed to read past end of stream.
at System.IO.BinaryReader.ReadChar () [0x00000] in <filename unknown>:0
at Microsoft.CodeAnalysis.CvtResFile.ReadStringOrID (System.IO.BinaryReader fhIn) [0x00000] in <filename unknown>:0
at Microsoft.CodeAnalysis.CvtResFile.ReadResFile (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at Microsoft.CodeAnalysis.Compilation.MakeWin32ResourceList (System.IO.Stream win32Resources, Microsoft.CodeAnalysis.DiagnosticBag diagnostics) [0x00000] in <filename unknown>:0
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.SetupWin32Resources (Microsoft.CodeAnalysis.CSharp.Emit.PEModuleBuilder moduleBeingBuilt, System.IO.Stream win32Resources, Microsoft.CodeAnalysis.DiagnosticBag diagnostics) [0x00000] in <filename unknown>:0
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CompileImpl (Microsoft.CodeAnalysis.Emit.CommonPEModuleBuilder moduleBuilder, System.IO.Stream win32Resources, System.IO.Stream xmlDocStream, Boolean generateDebugInfo, Microsoft.CodeAnalysis.DiagnosticBag diagnostics, System.Predicate`1 filterOpt, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0
at Microsoft.CodeAnalysis.Compilation.Compile (Microsoft.CodeAnalysis.Emit.CommonPEModuleBuilder moduleBuilder, System.IO.Stream win32Resources, System.IO.Stream xmlDocStream, Boolean generateDebugInfo, Microsoft.CodeAnalysis.DiagnosticBag diagnostics, System.Predicate`1 filterOpt, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0
at Microsoft.CodeAnalysis.Compilation.Emit (Microsoft.CodeAnalysis.EmitStreamProvider peStreamProvider, Microsoft.CodeAnalysis.EmitStreamProvider pdbStreamProvider, Microsoft.CodeAnalysis.EmitStreamProvider xmlDocumentationStreamProvider, Microsoft.CodeAnalysis.EmitStreamProvider win32ResourcesStreamProvider, IEnumerable`1 manifestResources, Microsoft.CodeAnalysis.Emit.EmitOptions options, Microsoft.CodeAnalysis.CodeGen.CompilationTestData testData, System.Func`1 getHostDiagnostics, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0
at Microsoft.CodeAnalysis.Compilation.Emit (System.IO.Stream peStream, System.IO.Stream pdbStream, System.IO.Stream xmlDocumentationStream, System.IO.Stream win32Resources, IEnumerable`1 manifestResources, Microsoft.CodeAnalysis.Emit.EmitOptions options, Microsoft.CodeAnalysis.CodeGen.CompilationTestData testData, System.Func`1 getHostDiagnostics, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0
at Microsoft.CodeAnalysis.Compilation.Emit (System.IO.Stream peStream, System.IO.Stream pdbStream, System.IO.Stream xmlDocumentationStream, System.IO.Stream win32Resources, IEnumerable`1 manifestResources, Microsoft.CodeAnalysis.Emit.EmitOptions options, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0
at Microsoft.Framework.Runtime.Roslyn.RoslynProjectReference.EmitAssembly (System.String outputPath) [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.ProjectBuilder.Build (System.String name, System.String outputPath) [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.BuildContext.Build (System.Collections.Generic.List`1 diagnostics) [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.BuildManager.Build () [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.Program+<>c__DisplayClass3_4.<Main>b__8 () [0x00000] in <filename unknown>:0
at Microsoft.Framework.Runtime.Common.CommandLine.CommandLineApplication.Execute (System.String[] args) [0x00000] in <filename unknown>:0
at Microsoft.Framework.PackageManager.Program.Main (System.String[] args) [0x00000] 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) [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 Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) [0x00000] in <filename unknown>:0
at dnx.host.Bootstrapper.RunAsync (System.Collections.Generic.List`1 args) [0x00000] in <filename unknown>:0
This is known issue and we have notified the Mono team https://bugzilla.xamarin.com/show_bug.cgi?id=29499
Thanks @suhasj.
Is there a preferred DNVM/Mono combination at the moment? Since the mono Homebrew formula has been updated to 4.0.1 is there a recommended way to get a stable environment to build/run the samples?
/cc @glennc
I am not sure of this since I have hit issues with both 4.0.1 and 4.1.0
Same issue here, mono 4.0.1 and dnx 4.5.1, please advice
beta4 + mono 4.0.1 and 4.1 have this issue and there's no known workaround.
Issue also appears in the following combination
Mono 4.0.1
dnx and dnu 1.0.0-beta5-11649
dnvm 1.0.0-beta5-10371
:cry:
FWIW...
If you, like me, decided to uninstall Mono 3.x after installing 4.x and will like to get back to a somewhat stable state. You can unlink Mono 4.x and reinstall 3.x by doing the following:
brew unlink mono
brew install https://raw.githubusercontent.com/Homebrew/homebrew/68a18ac660515e313cd175c550e3065320dfadec/Library/Formula/mono.rb
Unfortunately, all of the issues that exist with running Mono 3.x and the latest DNX will continue, but at least you'll be able to play around with Visual Studio Code on Mac :-)
Possible workaround? (This is what I did)
- clone mono repository, compile and install following the directions here http://www.mono-project.com/docs/compiling-mono/
- brew tap aspnet/dnx
- brew upgrade
- brew install dnvm --without-mono
I had to uninstall everything mono-related that brew installed. But after doing this I was able to run dnu build, dnx . kestrel, etc
@jpack61108 I haven't gone as far as building/running Mono from the latest repo. Curious... Did you have Mono installed prior to this, whether via brew or otherwise? Also, where/how did you discover the --without-mono switch? I haven't seen that documented anywhere. Thanks.
Yes I did, from brew. I had to remove all of the brew stuff because of all the symlinking that it does. So far it is working as advertised. James Sent from Outlook
On Mon, May 4, 2015 at 9:03 PM -0700, "Miguel Lira" [email protected] wrote:
@jpack61108 I haven't gone as far as building/running Mono from the latest repo. Curious... Did you have Mono installed prior to this, whether via brew or otherwise? Also, where/how did you discover the --without-mono switch? I haven't seen that documented anywhere. Thanks.
— Reply to this email directly or view it on GitHub.
Sorry brew options $FORMULA_NAME will show you the available options for install. I believe it is on the brew wiki. James
Sent from Outlook
On Mon, May 4, 2015 at 9:06 PM -0700, "Jimmy Pack" [email protected] wrote:
Yes I did, from brew. I had to remove all of the brew stuff because of all the symlinking that it does. So far it is working as advertised. James Sent from Outlook
On Mon, May 4, 2015 at 9:03 PM -0700, "Miguel Lira" [email protected] wrote:
@jpack61108 I haven't gone as far as building/running Mono from the latest repo. Curious... Did you have Mono installed prior to this, whether via brew or otherwise? Also, where/how did you discover the --without-mono switch? I haven't seen that documented anywhere. Thanks.
— Reply to this email directly or view it on GitHub.
@jpack61108 Thanks for the tip. I'm ready to give this a shot. Quick question, where did you install Mono? The docs suggest /mono but I'd assume you'd run into all sort of permission issues.
@jpack61108 Decided to pull the trigger and installed mono from source at /Users/miguellira/mono. Grabbed the latest HelloMvc sample and both beta4 and the latest (beta5-11682 as of this post) have fully functional builds without any errors!
I would like to point out, however, that (as indicated in the Compiling Mono on Mac OS X article) in order to install Mono from source you need Mono installed. Also, in order to ensure the new mono is used I added the path to my ~/.bash_profile:
PATH=/Users/miguellira/mono/bin:$PATH
Nice!! I put mine in the same place that brew does. Never really thought about putting it elsewhere
Sent from Outlook
@jpack61108 Decided to pull the trigger and installed mono from source at /Users/miguellira/mono. Grabbed the latest HelloMvc sample and both beta4 and the latest (beta5-11682 as of this post) have fully functional builds without any errors!
I would like to point out, however, that (as indicated in the Compiling Mono on Mac OS X article) in order to install Mono from source you need Mono installed. Also, in order to ensure the new mono is used I added the path to my ~/.bash_profile:
PATH=/Users/miguellira/mono/bin:$PATH
— Reply to this email directly or view it on GitHub.
To work around having to have mono installed to compile mono, before running make, I ran make get-monolite-latest, then make. James
Sent from Outlook
Nice!! I put mine in the same place that brew does. Never really thought about putting it elsewhere
Sent from Outlook
@jpack61108 Decided to pull the trigger and installed mono from source at /Users/miguellira/mono. Grabbed the latest HelloMvc sample and both beta4 and the latest (beta5-11682 as of this post) have fully functional builds without any errors!
I would like to point out, however, that (as indicated in the Compiling Mono on Mac OS X article) in order to install Mono from source you need Mono installed. Also, in order to ensure the new mono is used I added the path to my ~/.bash_profile:
PATH=/Users/miguellira/mono/bin:$PATH
— Reply to this email directly or view it on GitHub.
@miguellira
I am not sure but I think the way I did it breaks the intellisense for c# in VS Code.
Are you still getting Intellisense for c#?
@jpack61108 Yep, same here. Statement completion only works if I remove the PATH to my 4.1.0 version of Mono and use the 4.0.1 version installed via brew.
I'm guessing this has to do with how Omnisharp within VSCode looks for Mono. My Atom/Omnisharp setup works just fine against Mono 4.1.0. Going to dig around if I come up with a fix I'll post, please do the same.
@miguellira Will do.
@miguellira Super-Hack but what I am doing until they patch everything is leaving the 4.0.1 on the path and when I want to run the build commands that require the 4.1.0 just enter PATH=/Path/to/mono/4.1.0/:$PATH
Then I can build when I want and still get the awesome intellisense that Omnisharp offers. Im sure that could probably be automated in some way, I am not that clever yet.