Skip to content

Use of a method/property unavailable in the target platform version (UnavailableMemberCall)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Error BSL Major Yes 5 suspicious

Description

The diagnostic triggers on a method call or property access of a platform type that is available only since a platform version newer than the project compatibility mode. Using such a member will fail in the environment matching the selected compatibility mode.

The version a member becomes available in is taken from the syntax assistant of the installed 1C platform (via bsl-context) or from the bundled reference. Triggering respects the target platform version: a member is treated as unavailable when the target version is lower than the version the member was introduced in. The target version is resolved by priority: the v8platform.targetVersion setting, then the configuration compatibility mode, and if neither is set the newest platform is assumed and the check does not trigger.

When the object type may be inferred as one of several types (for example, a variable assigned values of different types in different code branches), the diagnostic triggers if the member is unavailable for at least one of the possible types.

Examples

The target platform version is 8.3.10 (v8platform.targetVersion or the compatibility mode), while the ВопросАсинх (DoQueryBoxAsync) method is available only since 8.3.18:

// Triggers: the method is available only since version 8.3.18
Оповещение = Новый ОписаниеОповещения("ПослеВопроса", ЭтотОбъект);
ВопросАсинх(Оповещение, "Продолжить?", РежимДиалогаВопрос.ДаНет);

Fix it by raising the target platform version to a supported one, or by using a member available in the target version (for example, the synchronous Вопрос / DoQueryBox):

Ответ = Вопрос("Продолжить?", РежимДиалогаВопрос.ДаНет);

Sources

  • Source: 1C:Enterprise 8 platform syntax assistant

Snippets

Diagnostic ignorance in code

// BSLLS:UnavailableMemberCall-off
// BSLLS:UnavailableMemberCall-on

Parameter for config

"UnavailableMemberCall": false