Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

'Add-Type' produces different assemblies when running the same source code multiple times in PS Core #5515

Copy link
Copy link
@daxian-dbw

Description

@daxian-dbw
Issue body actions

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.

> (Add-Type $code -PassThru).Assembly.FullName
4woxc1pb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
> (Add-Type $code -PassThru).Assembly.FullName
4woxc1pb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
> (Add-Type $code -PassThru).Assembly.FullName
4woxc1pb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

Actual behavior

> (Add-Type $code -PassThru).Assembly.FullName
z4vydr0b.yke, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
> (Add-Type $code -PassThru).Assembly.FullName
gyos43ig.yjb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
> (Add-Type $code -PassThru).Assembly.FullName
wsxcciz3.544, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

Environment data

> $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
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.