# Why loading file to editor drops all registered assemblies?

**URL:** <https://forum.alternetsoft.com/t/why-loading-file-to-editor-drops-all-registered-assemblies/255>\
**Category:** AlterNET Studio Support\
**Tags:** editor\
**Created:** [November 11, 2021, 4:40pm UTC](https://forum.alternetsoft.com/t/why-loading-file-to-editor-drops-all-registered-assemblies/255 "2021-11-11T16:40:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![audrius](https://forum.alternetsoft.com/letter_avatar_proxy/v4/letter/a/606060/32.png) [@audrius](https://forum.alternetsoft.com/u/audrius)\
**Post date:** [November 11, 2021, 4:40pm UTC](https://forum.alternetsoft.com/t/why-loading-file-to-editor-drops-all-registered-assemblies/255/1 "2021-11-11T16:40:00Z")

</div>

edit.RegisterAssembly(typeof(CustomType).Assembly.Location);  
edit.LoadFile(fileName); or edit.FileName = fileName; where edit is Alternet.Editor.Common.Wpf.ScriptCodeEdit drops before registered assembly.

Is there way to prevent? Is it a bug?

---

<div class="post-metadata">

**Author:** ![dmitry.medvedev](https://forum.alternetsoft.com/user_avatar/forum.alternetsoft.com/dmitry.medvedev/32/27_2.png) [@dmitry.medvedev](https://forum.alternetsoft.com/u/dmitry.medvedev)\
**Post date:** [November 12, 2021, 8:16am UTC](https://forum.alternetsoft.com/t/why-loading-file-to-editor-drops-all-registered-assemblies/255/2 "2021-11-12T08:16:00Z")

</div>

Hi Audrius,

RegisterAssemblies/RegisterAssembly needs FileName to be set beforehand. Setting Filename creates creates editor’s parser based on the file name’s extension, which is used in RegisterAssembly.  
RegisterAssemblies internally uses underlying solution, but again it determines which one to use (for C# or Visualbasic) based on file’s extension.

If you already have filename set, changing it to another one (with the same extension) should not reset assemblies.

Let me know if it helps.

Regards,  
Dmitry
