/// <summary> /// Clears all internal caches. /// </summary> /// <param name="mode">The clear mode.</param> public virtual void ClearCache(ClearCacheMode mode) { // Synchronize all accesses below using a write scope using var writeScope = cachingLock.EnterWriteScope(); typeInfoMapping.Clear(); InitIntrinsicTypeInformation(); }
/// <summary> /// Reloads the assembly builder. /// </summary> private void ReloadAssemblyBuilder() { using var writerLock = assemblyLock.EnterWriteScope(); assemblyVersion = GetNextAssemblyVersion(); var assemblyName = new AssemblyName(AssemblyName) { Version = new Version(1, assemblyVersion), }; assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly( assemblyName, AssemblyBuilderAccess.RunAndCollect); moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name); }