简体   繁体   English

“Option Strict On禁止隐式转换”执行不一致

[英]“Option Strict On disallows implicit conversions” inconsistent enforcement

  • configuration 1: building ESRI add-ins for ArcMap 10.4 using Visual Studio 2015 targeting the .NET 4.5.2 framework 配置1:使用面向.NET 4.5.2框架的Visual Studio 2015为ArcMap 10.4构建ESRI加载项
  • configuration 2: building ESRI add-ins for ArcMap 10.3 using Visual Studio 2013 targeting the .NET 3.5 framework 配置2:使用面向.NET 3.5框架的Visual Studio 2013为ArcMap 10.3构建ESRI加载项
  • configuration 3: building ESRI add-ins for ArcMap 10.4 using Visual Studio 2013 targeting the .NET 4.5.2 framework 配置3:使用面向.NET 4.5.2框架的Visual Studio 2013为ArcMap 10.4构建ESRI加载项

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. 我试图理解为什么VB.NET项目中的Option Strict On强制执行不会在两个项目中引发错误BC30512而在另一个项目中会引发错误。 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. 下面是一个示例代码行,它使用配置1触发错误,但不会触发配置2或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): 此外,如果我实例化托管类而不是coclass,则在任一配置中都不会触发错误(请参阅以下行):

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. 不同版本的ArcMap决定了该框架的目标版本。 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) 有关其他背景,ArcObjects文档的COM到.NET类型转换是相关的: 在.NET中使用ArcObjects(基于COM)(ArcObjects .NET 10.4 SDK)

Why is the error triggered in configuration 1 and not in configuration 2 or 3? 为什么在配置1中触发错误而在配置2或3中没有触发? And why isn't the error triggered in configuration 1 when instantiated with the managed class instead of the coclass? 为什么在使用托管类而不是coclass实例化时,配置1中是否触发了错误?

Link to an issue submitted at the dotnet/roslyn github repository. 链接到dotnet / roslyn github存储库提交的问题。 https://github.com/dotnet/roslyn/issues/13314 https://github.com/dotnet/roslyn/issues/13314

Thanks Shea 谢谢谢

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. 此时,它似乎(正如Hans Passant在原帖中的评论中所建议的)这确实是Visual Studio 2015中Roslyn编译器的一个错误。我在dotnet / roslyn GitHub存储库中打开了一个问题,它已经被标记了一个错误并分配给了一个团队成员。 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 问题的链接和其他疑难解答信息是https://github.com/dotnet/roslyn/issues/13314

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Option Strict On 禁止 String 和 Object {String} 之间的隐式转换 - Option Strict On disallows implicit conversions between String and Object {String} 严格的选项不允许在“布尔值”之间进行隐式转换 在SQL语句中布尔 - option strict on disallows implicit conversions between 'boolean?' to boolean in SQL statement Option Strict On不允许从'String'到'Boolean'的隐式转换 - Option Strict On disallows implicit conversions from 'String' to 'Boolean' Option Strict On 不允许从“String”到“Double”的隐式转换 - Option Strict On disallows implicit conversions from 'String' to 'Double' 错误:Option Strict On不允许从“对象”到“十进制”的隐式转换 - Error: Option Strict On disallows implicit conversions from 'Object' to 'Decimal' Option Strict On不允许从'ADODB.Recordset'到'ADODB.Recordset'的隐式转换 - Option Strict On disallows implicit conversions from 'ADODB.Recordset' to 'ADODB.Recordset' Option Strict On不允许从'System.Drawing.Point'到'System.Drawing.Size'的隐式转换 - Option Strict On disallows implicit conversions from 'System.Drawing.Point' to 'System.Drawing.Size' VB.NET 错误消息 - “Option Strict On 不允许从 'Object' 到 'String' 的隐式转换” - VB.NET error message - “Option Strict On disallows implicit conversions from 'Object' to 'String'” Option Strict On 禁止从 'String' 到 'Char' VB.NET 的隐式转换 - Option Strict On disallows implicit conversions from 'String ' to 'Char' VB.NET 选项严格禁止从字符串到双精度和双精度到字符串的隐式转换 - Option strict on disallows implicit conversion from string to double and double to string
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM