Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UseObjectInitializer throws exception in ASP.NET Project #15076

Closed
jmarolf opened this issue Nov 8, 2016 · 4 comments
Closed

UseObjectInitializer throws exception in ASP.NET Project #15076

jmarolf opened this issue Nov 8, 2016 · 4 comments

Comments

@jmarolf
Copy link
Contributor

jmarolf commented Nov 8, 2016

Version Used: d15rel/15.0.25902.2

Steps to Reproduce:

  1. Have the web workload installed
  2. Download this project
  3. Open the project and do the required SQL project updated
  4. Navigate to InstructorController.cs

Expected Behavior:
No analyzer crash

Actual Behavior:

Warning	AD0001	Analyzer 'Microsoft.CodeAnalysis.CSharp.UseObjectInitializer.CSharpUseObjectInitializerDiagnosticAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Specified cast is not valid.'.
'Exception occurred with following context:
Compilation: ContosoUniversity
SyntaxTree: C:\Users\jmarolf\Downloads\ASP.NET MVC Application Using Entity Framework Code First\C#\ContosoUniversity\Controllers\InstructorController.cs
SyntaxNode: new InstructorIndexData() [ObjectCreationExpressionSyntax]@[610..635) (22,28)-(22,53)

System.InvalidCastException: Specified cast is not valid.
   at Microsoft.CodeAnalysis.Options.OptionSet.GetOption[T](PerLanguageOption`1 option, String language)
   at Microsoft.CodeAnalysis.UseObjectInitializer.AbstractUseObjectInitializerDiagnosticAnalyzer`7.FadeOutCode(SyntaxNodeAnalysisContext context, OptionSet optionSet, List`1 matches, ImmutableArray`1 locations)
   at Microsoft.CodeAnalysis.UseObjectInitializer.AbstractUseObjectInitializerDiagnosticAnalyzer`7.AnalyzeNode(SyntaxNodeAnalysisContext context)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass42_1`1.<ExecuteSyntaxNodeAction>b__1()
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock(DiagnosticAnalyzer analyzer, Action analyze, Nullable`1 info)
@CyrusNajmabadi
Copy link
Member

@Pilchie This is something to do with option deserialization.

@Pilchie
Copy link
Member

Pilchie commented Nov 15, 2016

@jasonmalinowski does this look like any of your other serializer bugs

@Pilchie
Copy link
Member

Pilchie commented Dec 5, 2016

@jasonmalinowski is this also fixed by #15502?

@jmarolf
Copy link
Contributor Author

jmarolf commented Jan 11, 2017

fixed with #16373

@jmarolf jmarolf closed this as completed Jan 11, 2017
@jmarolf jmarolf removed their assignment Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants