3
  • configuration 1: building ESRI add-ins for ArcMap 10.4 using Visual Studio 2015 targeting the .NET 4.5.2 framework
  • configuration 2: building ESRI add-ins for ArcMap 10.3 using Visual Studio 2013 targeting the .NET 3.5 framework
  • configuration 3: building ESRI add-ins for ArcMap 10.4 using Visual Studio 2013 targeting the .NET 4.5.2 framework

I'm trying to understand why the Option Strict On enforcement in VB.NET projects does not raise error BC30512 in two projects and it does in another. Here is an an example line of code that triggers the error using configuration 1 but does not trigger the error with configuration 2 or 3.

Dim bufferedPolygon As ESRI.ArcGIS.Geometry.IGeometry = New ESRI.ArcGIS.Geometry.Polygon

Additionally, if I instantiate the managed class instead of the coclass, the error is not triggered in either configuration (see following line):

Dim bufferedPolygon As ESRI.ArcGIS.Geometry.IGeometry = New ESRI.ArcGIS.Geometry.PolygonClass

The different versions of ArcMap dictate which version of the framework is targeted. For additional background, the COM to .NET Type Conversion of the ArcObjects documentation is relevant: Using ArcObjects (COM-based) in .NET (ArcObjects .NET 10.4 SDK)

Why is the error triggered in configuration 1 and not in configuration 2 or 3? And why isn't the error triggered in configuration 1 when instantiated with the managed class instead of the coclass?

Link to an issue submitted at the dotnet/roslyn github repository. https://github.com/dotnet/roslyn/issues/13314

Thanks Shea

isburns
  • 41
  • 5
  • 2
    The Roslyn integration in VS2015 has caused a lot of havoc. The scenario is unusual so this hasn't been put the test much, Polygon is a COM interface type, the "class interface", so syntactically you go directly from one interface to another one implemented by the Polygon coclass. Rejecting this *might* be by design, it might be a plain bug. Leaning to bug. Click the [New Issue button](https://github.com/dotnet/roslyn/issues) to hear it from the people that work on this. – Hans Passant Aug 19 '16 at 21:24
  • Thanks Hans, I will try a third configuration building the add-in for ArcMap 10.4 using Visual Studio 2013 and targeting .NET 4.5.2 and see if the error is triggered and edit the original post to include the results of that test. – isburns Aug 19 '16 at 22:12
  • @isburns – in case you create the "New issue" as Hans recommended, please post a link here so it can be revisited from here. – miroxlav Aug 20 '16 at 18:33
  • Will do @miroxlav, I want to test the third configuration before doing so though. – isburns Aug 20 '16 at 23:55
  • @miroxlav, I have created a [new issue](https://github.com/dotnet/roslyn/issues/13314) at the github repository. – isburns Aug 23 '16 at 01:35
  • @isburns – Good. Maybe you can post short answer describing this and accept it so people can not only easily find, but also upvote your findings/solution. – miroxlav Aug 23 '16 at 10:53

1 Answers1

1

At this time, it appears (as Hans Passant suggested in a comment on the original post) that this is indeed a bug with the Roslyn compiler in Visual Studio 2015. I opened an issue at the dotnet / roslyn GitHub repository, and it has been labeled a bug and assigned to a team member. The status of this could change as the issue is investigated.

The link to the issue and additional troubleshooting information is https://github.com/dotnet/roslyn/issues/13314

isburns
  • 41
  • 5