Bug 26840 - InternalErrorException on specifying Optional attribute
Summary: InternalErrorException on specifying Optional attribute
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-02-08 08:29 UTC by Leonid Shalupov
Modified: 2015-02-10 02:50 UTC (History)
1 user (show)

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


Attachments
Repro (293 bytes, text/plain)
2015-02-08 08:30 UTC, Leonid Shalupov
Details

Description Leonid Shalupov 2015-02-08 08:29:33 UTC
"mcs -unsafe b.cs" fails exception. See attached file for source.

Unhandled Exception:
Mono.CSharp.InternalErrorException: b.cs(4,11): test ---> Mono.CSharp.InternalErrorException: b.cs(6,29): test.MainClass ---> Mono.CSharp.InternalErrorException: b.cs(13,25): test.MainClass.FooDelegate ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at Mono.CSharp.Parameter.ResolveDefaultValue (Mono.CSharp.ResolveContext rc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.ParametersCompiled.ResolveDefaultValues (Mono.CSharp.MemberCore m) [0x00000] in <filename unknown>:0
  at Mono.CSharp.Delegate.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.CompilationSourceFile.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.ModuleContainer.EmitContainer () [0x00000] in <filename unknown>:0
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.AssemblyDefinitionStatic.Emit () [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: b.cs(4,11): test ---> Mono.CSharp.InternalErrorException: b.cs(6,29): test.MainClass ---> Mono.CSharp.InternalErrorException: b.cs(13,25): test.MainClass.FooDelegate ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at Mono.CSharp.Parameter.ResolveDefaultValue (Mono.CSharp.ResolveContext rc) [0x00000] in <filename unknown>:0
  at Mono.CSharp.ParametersCompiled.ResolveDefaultValues (Mono.CSharp.MemberCore m) [0x00000] in <filename unknown>:0
  at Mono.CSharp.Delegate.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.CompilationSourceFile.PrepareEmit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.ModuleContainer.EmitContainer () [0x00000] in <filename unknown>:0
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0
  at Mono.CSharp.AssemblyDefinitionStatic.Emit () [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 Leonid Shalupov 2015-02-08 08:30:21 UTC
Created attachment 9697 [details]
Repro
Comment 2 Marek Safar 2015-02-10 02:50:11 UTC
Fixed in master

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.


Create a new report for Bug 26840 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments


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.

Related Links: