Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessor Semantics enforce incorrect usage patterns #894

Closed
cleemullins opened this issue Apr 25, 2019 · 0 comments · Fixed by #945
Closed

Accessor Semantics enforce incorrect usage patterns #894

cleemullins opened this issue Apr 25, 2019 · 0 comments · Fixed by #945
Assignees
Labels
4.5 bug Indicates an unexpected problem or an unintended behavior.

Comments

@cleemullins
Copy link
Contributor

All Versions.

In Botstate.ts there is a problem with how accessors are created:

   public createProperty<T = any>(name: string): StatePropertyAccessor<T> {
        if (this.properties.has(name)) { throw new Error(`BotState.createProperty(): a property named '${ name }' already exists.`); }
        const prop: BotStatePropertyAccessor<T> = new BotStatePropertyAccessor<T>(this, name);
        this.properties.set(name, prop);

        return prop;
    }

The dictionary that's used to gate the accessor creation is not needed. This prevents multiple accessors from being created, and forces bots to use global static accessors.

This signifigantly differs from the C# code, which allows these to be created at-will:

        public IStatePropertyAccessor<T> CreateProperty<T>(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            return new BotStatePropertyAccessor<T>(this, name);
        }

This difference bleeds into the samples in unexpected ways, and has caused @johnataylor to 💥 💥 💥. He's been 😾 as he tries to get the sidecar worked wrapped up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.5 bug Indicates an unexpected problem or an unintended behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants