Bug 16196 - Uncaught MissingAssemblyException
Summary: Uncaught MissingAssemblyException
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 3.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-11-13 10:51 UTC by Julian Tibble
Modified: 2013-11-14 10:30 UTC (History)
1 user (show)

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


Attachments
The file that sometimes compiles successfully (535 bytes, application/octet-stream)
2013-11-13 10:51 UTC, Julian Tibble
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Julian Tibble 2013-11-13 10:51:26 UTC
Created attachment 5417 [details]
The file that sometimes compiles successfully

BEHAVIOUR

A C# file (SomeContent.cs) compiles fine with a reference to System.Net.Http.

If a reference to System.Net.Http.Primitives is also added, then mcs reports an unhandled exception (MissingAssemblyException), although Microsoft's C# compiler succeeds.

If a reference to System.Net.Primitives is added as well, then mcs succeeds.


EXPECTED BEHAVIOUR

All three compilations succeed (as with Microsoft's C# compiler).



OUTPUT

$ mcs --version
Mono C# compiler version 3.2.3.0

$ mcs SomeContent.cs /target:library \
                     /reference:System.Net.Http

$ mcs SomeContent.cs /target:library \
                     /reference:System.Net.Http \
                     /reference:System.Net.Http.Primitives \
                     /reference:System.Net.Primitives

$ mcs SomeContent.cs /target:library \
                     /reference:System.Net.Http \
                     /reference:System.Net.Http.Primitives

Unhandled Exception:
Mono.CSharp.InternalErrorException: SomeContent.cs(11,32): SomeContent.SerializeToStreamAsync(System.IO.Stream, TransportContext) ---> IKVM.Reflection.MissingAssemblyException: Assembly 'System.Net.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is a missing assembly and does not support the requested operation.
  at IKVM.Reflection.MissingAssembly.get_Location () [0x00000] in <filename unknown>:0
  at Mono.CSharp.ImportedAssemblyDefinition.get_Location () [0x00000] in <filename unknown>:0
  at Mono.CSharp.Report.SymbolRelatedToPreviousError (Mono.CSharp.MemberSpec ms) [0x00000] in <filename unknown>:0
  at Mono.CSharp.Namespace.LookupType (IMemberContext ctx, System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.NamespaceContainer.Lookup (System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.NamespaceContainer.LookupNamespaceOrType (System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.LookupNamespaceOrType (System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.MemberCore.LookupNamespaceOrType (System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.Method.LookupNamespaceOrType (System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.SimpleName.ResolveAsTypeOrNamespace (IMemberContext mc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.FullNamedExpression.ResolveAsType (IMemberContext mc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.Parameter.Resolve (IMemberContext rc, Int32 index) [0x00000] in <filename unknown>:0
  at Mono.CSharp.ParametersCompiled.Resolve (IMemberContext ec) [0x00000] in <filename unknown>:0
  at Mono.CSharp.InterfaceMemberBase.DefineParameters (Mono.CSharp.ParametersCompiled parameters) [0x00000] in <filename unknown>:0
  at Mono.CSharp.MethodCore.CheckBase () [0x00000] in <filename unknown>:0
  at Mono.CSharp.MethodOrOperator.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.Method.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.DoDefineMembers () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeDefinition.DoDefineMembers () [0x00000] in <filename unknown>:0
  at Mono.CSharp.ClassOrStruct.DoDefineMembers () [0x00000] in <filename unknown>:0
  at Mono.CSharp.Class.DoDefineMembers () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeContainer.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeContainer.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.ModuleContainer.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: Mono.CSharp.InternalErrorException: SomeContent.cs(11,32): SomeContent.SerializeToStreamAsync(System.IO.Stream, TransportContext) ---> IKVM.Reflection.MissingAssemblyException: Assembly 'System.Net.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is a missing assembly and does not support the requested operation.
  at IKVM.Reflection.MissingAssembly.get_Location () [0x00000] in <filename unknown>:0
  at Mono.CSharp.ImportedAssemblyDefinition.get_Location () [0x00000] in <filename unknown>:0
  at Mono.CSharp.Report.SymbolRelatedToPreviousError (Mono.CSharp.MemberSpec ms) [0x00000] in <filename unknown>:0
  at Mono.CSharp.Namespace.LookupType (IMemberContext ctx, System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.NamespaceContainer.Lookup (System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.NamespaceContainer.LookupNamespaceOrType (System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.LookupNamespaceOrType (System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.MemberCore.LookupNamespaceOrType (System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.Method.LookupNamespaceOrType (System.String name, Int32 arity, LookupMode mode, Location loc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.SimpleName.ResolveAsTypeOrNamespace (IMemberContext mc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.FullNamedExpression.ResolveAsType (IMemberContext mc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.Parameter.Resolve (IMemberContext rc, Int32 index) [0x00000] in <filename unknown>:0
  at Mono.CSharp.ParametersCompiled.Resolve (IMemberContext ec) [0x00000] in <filename unknown>:0
  at Mono.CSharp.InterfaceMemberBase.DefineParameters (Mono.CSharp.ParametersCompiled parameters) [0x00000] in <filename unknown>:0
  at Mono.CSharp.MethodCore.CheckBase () [0x00000] in <filename unknown>:0
  at Mono.CSharp.MethodOrOperator.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.Method.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.DoDefineMembers () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeDefinition.DoDefineMembers () [0x00000] in <filename unknown>:0
  at Mono.CSharp.ClassOrStruct.DoDefineMembers () [0x00000] in <filename unknown>:0
  at Mono.CSharp.Class.DoDefineMembers () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeContainer.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeContainer.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.ModuleContainer.Define () [0x00000] in <filename unknown>:0
  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
Comment 1 Marek Safar 2013-11-14 04:26:30 UTC
Could you attach all referenced assemblies. The version of System.Net.Http* dlls I was trying with works for me as expected.
Comment 4 Julian Tibble 2013-11-14 05:14:51 UTC
I've attached the two DLLs that are not a part of my Mono distribution. The System.Net.Http that I'm using is the standard one shipped with Mono.
Comment 5 Julian Tibble 2013-11-14 05:16:23 UTC
(although I have also triggered the same problem with a .NET 4 System.Net.Http)
Comment 6 Marek Safar 2013-11-14 10:30:47 UTC
Fixed in master