jmoreno
jmoreno

Reputation: 13571

Disabling a late binding error in vb not working

Now that Roslyn has been released, we VB can disable specific warnings via "#Disable Warning BCxxxx", but when I try disable the warning for late binding (so I can have strict on except where it needs to be off), it still shows as an error. I have tried disabling all of the warnings that get removed when you go from Strict Off to Strict On, as well as the actual errors that get reported (BC30574 , BC30512) but the errors remain. Am I just missing the right thing to disable, or have they not in fact fixed the problem of not being able to turn Option Strict On off only where it is needed?

#Disable Warning BC42016
#Disable Warning BC41999
#Disable Warning BC42017
#Disable Warning BC42018
#Disable Warning BC42019
#Disable Warning BC42032
#Disable Warning BC42036
#Disable Warning BC42021
#Disable Warning BC42022

#Disable Warning BC30574
#Disable Warning BC30512

Upvotes: 0

Views: 662

Answers (1)

Nitram
Nitram

Reputation: 6716

While option strict is enabled, late binding is treated as error and not as warning. This means you can't disable it.

While you can't enable option strict, the configuration dialog of the project allows you to change the settings for the different problems. If you set the entry for late binding to warning, you will be able to handle the issues like this.

But option strict is still not possible in the same project as late binding.

Upvotes: 2

Related Questions