user3733340
user3733340

Reputation: 45

Roslyn: Missing method exception for VSIX package

I have problems since I have updated "Microsoft.CodeAnalysis.CSharp.Scripting" to 1.3.2.

Steps to reproduce:

  1. Create a VS add-in with EditorMargin class.
  2. Change .NET to 4.6
  3. Install Microsoft.CodeAnalysis.CSharp.Scripting and Microsoft.CodeAnalysis.CSharp.
  4. Put somewhere in ctor the following code:

    var t = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)
    

After running the add-in it will throw a

Missing method exception

It cannot find a constructor of CSharpCompilationOptions. I noticed that when I don't install "Microsoft.CodeAnalysis.CSharp.Scripting" (which is not necessary in the above case), everything works. I guess one of dependencies of Microsoft.CodeAnalysis.CSharp.Scripting installs some packages.

I tried to run "Fuslogvw" to see if there are any binding errors but I could not find anything useful.

Any ideas?

Update - I use Visual Studio 2015 update 3

Update 2 I downgraded "System.Collections.Immutable" from 1.2.0 to 1.1.37 and it works again. Update 3 I found the reported bug: https://github.com/dotnet/roslyn/issues/12247

The problem is I need to use 1.2.0 because Roslyn scripting API uses that version.

Upvotes: 2

Views: 468

Answers (3)

Reudismam
Reudismam

Reputation: 107

I was able to resolve this problem installing Visual Studio 2017. VS 2017 requires System.Collection.Immutable 1.2.1.0, which does not conflict with other Roslyn versions

Upvotes: 0

user3733340
user3733340

Reputation: 45

The current workaround for me is to downgrade Microsoft.CodeAnalysis.Csharp.Scripting to the version which works with "System.Collections.Immutable 1.1.37"

Upvotes: 1

Jason Malinowski
Jason Malinowski

Reputation: 19021

If you're targeting package version 1.3.2, that means you're targeting Visual Studio 2015 Update 3, but I'm guessing you don't have that installed. Either downgrade to an older version (i.e. 1.2 if you're targeting Update 2, 1.1 if targeting Update 1), or upgrade your VS to a newer version.

Upvotes: 0

Related Questions