Bug 29499 - System.IO.EndOfStreamException when running dnx command
Summary: System.IO.EndOfStreamException when running dnx command
Status: RESOLVED DUPLICATE of bug 30171
Alias: None
Product: Runtime
Classification: Mono
Component: packaging (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Duncan Mak
URL:
Depends on:
Blocks:
 
Reported: 2015-04-28 17:21 UTC by Suhas
Modified: 2016-03-01 12:48 UTC (History)
9 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Ssample repro app (4.02 KB, application/x-zip-compressed)
2015-04-28 17:21 UTC, Suhas
Details

Description Suhas 2015-04-28 17:21:07 UTC
Running the latest 'dnu pack' command which packages an application into a Nuget package exists with the below error. This failing on Mono 4.0.1 but seems to be passing on 4.1.0 so I think the fix needs to be back ported

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_3.<Main>b__6 () [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 error repros consistently with the latest 4.0.1 version of Mono. 

Repro
- Install version 4.0.1 in Ubuntu
- Install latest dnx using dnvm as listed on http://github.com/aspnet/Home
- Unzip the attached project and run 'dnu restore' on it to restore packages
- Pack the console application attached using command `dnu pack'.

Expected: A Nuget package is created

Actual: Error with stacktrace as shown
Comment 1 Suhas 2015-04-28 17:21:39 UTC
Created attachment 10944 [details]
Ssample repro app
Comment 2 Alexander Köplinger 2015-05-04 15:13:57 UTC
I just tried this on mono master and it doesn't repro there anymore (it does on 4.0.1).
Comment 3 James Pack 2015-05-04 23:59:30 UTC
I can confirm that the issue is resolved in version 4.1.0.

I cloned the current mono repository and compiled and installed.
Then ran the following:

brew tap aspnet/dnx
brew upgrade
brew install dnvm --without-mono

So far everything is working as expected.
Comment 4 Dylan Borg 2015-05-07 14:54:37 UTC
Please back-port this to the 4.0 branch as the master branch currently has a broken VM when it comes to jitting certain generics code.
Comment 5 Marcin Cieślak 2015-06-04 18:09:52 UTC
I believe this bug is a duplicate of bug 30171 and the fix has landed in mono 4.0.1.44
Comment 6 Alexander Köplinger [MSFT] 2016-03-01 12:48:03 UTC

*** This bug has been marked as a duplicate of bug 30171 ***

Note You need to log in before you can comment on or make changes to this bug.