public void DoubleDisposeTest() { var spell = new SpellChecker("en-AU"); spell.Dispose(); spell.Dispose(); // No error }
/// <summary> /// Internal interop resource cleanup /// </summary> /// <param name="disposing"> /// False when called from the Finalizer /// True when called explicitly from Dispose() /// </param> protected override void Dispose(bool disposing) { if (_isDisposed) { throw new ObjectDisposedException(SR.Get(SRID.TextEditorSpellerInteropHasBeenDisposed)); } if (_spellCheckers != null) { foreach (Tuple <WordsSegmenter, SpellChecker> item in _spellCheckers.Values) { SpellChecker spellChecker = item?.Item2; if (spellChecker != null) { spellChecker.Dispose(); } } _spellCheckers = null; } ClearDictionaries(isDisposeOrFinalize: true); _isDisposed = true; }
/// <summary> /// Limpiar los recursos que se estén usando. /// </summary> /// <param name="disposing">true si los recursos administrados se deben desechar; false en caso contrario.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); spellChecker.Dispose(); } base.Dispose(disposing); }
public void MultiSessionTest() { var spell1 = new SpellChecker("en-us"); var spell2 = new SpellChecker("fr-fr"); var examples1 = spell1.Suggestions("doog").ToList(); spell1.Dispose(); var examples2 = spell2.Suggestions("doog").ToList(); Assert.AreEqual(examples1.Count(), 4); Assert.AreEqual(examples2.Count(), 2); }
public void MultiSessionTest() { var spell1 = new SpellChecker("en-us"); using var spell2 = new SpellChecker("fr-fr"); var examples1 = spell1.Suggestions("doog").ToList(); spell1.Dispose(); var examples2 = spell2.Suggestions("doog").ToList(); Assert.AreEqual(examples1.Count(), 4); Assert.AreEqual(examples2.Count(), 2); }
// Token: 0x06003F13 RID: 16147 RVA: 0x001200B8 File Offset: 0x0011E2B8 private void ReleaseAllResources(bool disposing) { if (this._spellCheckers != null) { foreach (Tuple <WordsSegmenter, SpellChecker> tuple in this._spellCheckers.Values) { SpellChecker spellChecker = (tuple != null) ? tuple.Item2 : null; if (spellChecker != null) { spellChecker.Dispose(); } } this._spellCheckers = null; } this.ClearDictionaries(disposing); }
/// <summary> /// Releases all resources by: /// <list type="bullet"> /// <item>disposing all IDisposables, which would in turn /// free up any associated respective native resources</item> /// <item>Unregistering all custom dictionaries</item> /// </list> /// </summary> /// <param name="disposing">True when called from <see cref="Dispose"/>, False when called from the Finalizer</param> private void ReleaseAllResources(bool disposing) { if (_spellCheckers != null) { foreach (Tuple<WordsSegmenter, SpellChecker> item in _spellCheckers.Values) { SpellChecker spellChecker = item?.Item2; if (spellChecker != null) { spellChecker.Dispose(); } } _spellCheckers = null; } ClearDictionaries(disposing); }
public void DoubleDisposeTest() { var spell = new SpellChecker("en-AU"); spell.Dispose(); spell.Dispose(); // No error }