You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
'Add-Type' produces different assemblies when running the same source code multiple times in PS Core #5515
On Windows PowerShell, Add-Type returns the same assembly when running it multiple times with the same source code.
While on PowerShell Core, Add-Type returns different assemblies when running it multiple times with the same source code.
Steps to reproduce
>$code=@'public class Foo { public string Name = "name";}'@> (Add-Type$code-PassThru).Assembly.FullName
Expected behavior
Like on Windows PowerShell, the same assembly is returned when using the same source code.
>$PSVersionTable
Name Value
---------
PSVersion 6.0.0-rc
PSEdition Core
GitCommitId v6.0.0-rc-3-g5702081ae6d116455f6cff30e7b509abf21ae609
OS Microsoft Windows 10.0.15063
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Currently Add-Type get a source code as string (even files are merged into a single string), evaluate a hash and save the hash in a cache. It allow avoid recompile the source code and reload it in new assembly. So we could fix the Issue and returm previous assembly from the cache as I guess Windows PowerShell does.
Activity
iSazonov commentedon Nov 21, 2017
Currently Add-Type get a source code as string (even files are merged into a single string), evaluate a hash and save the hash in a cache. It allow avoid recompile the source code and reload it in new assembly. So we could fix the Issue and returm previous assembly from the cache as I guess Windows PowerShell does.