[英]“Option Strict On disallows implicit conversions” inconsistent enforcement
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.