Title: Add-Type reference assembly bug · Issue #1616 · PowerShell/PowerShell · GitHub
Open Graph Title: Add-Type reference assembly bug · Issue #1616 · PowerShell/PowerShell
X Title: Add-Type reference assembly bug · Issue #1616 · PowerShell/PowerShell
Description: Steps to reproduce $source = @" using System; namespace Foo { public static class Bar { public static void Test() { Console.BackgroundColor = (Console.ConsoleColor) -1; } } } "@ Add-Type -TypeDefinition $source -Language CSharp -Referenc...
Open Graph Description: Steps to reproduce $source = @" using System; namespace Foo { public static class Bar { public static void Test() { Console.BackgroundColor = (Console.ConsoleColor) -1; } } } "@ Add-Type -TypeDefin...
X Description: Steps to reproduce $source = @" using System; namespace Foo { public static class Bar { public static void Test() { Console.BackgroundColor = (Console.ConsoleColor) -1; } } } "@ Add-Type ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/1616
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add-Type reference assembly bug","articleBody":"## Steps to reproduce\r\n\r\n``` powershell\r\n$source = @\"\r\nusing System;\r\nnamespace Foo {\r\npublic static class Bar {\r\npublic static void Test() {\r\nConsole.BackgroundColor = (Console.ConsoleColor) -1;\r\n}\r\n}\r\n}\r\n\"@\r\nAdd-Type -TypeDefinition $source -Language CSharp -ReferencedAssemblies System.Console\r\n```\r\n## Expected behavior\r\n\r\nThe type to be added.\r\n## Actual behavior\r\n\r\n```\r\nAdd-Type : (5) : The type 'Console' exists in both 'System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and\r\n'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'\r\n(4) : public static void Test() {\r\n(5) : >>> System.Console.BackgroundColor = (System.Console.ConsoleColor) -1;\r\n(6) : }\r\nAt line:1 char:1\r\n+ Add-Type -TypeDefinition $source -Language CSharp -ReferencedAssembli ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception\r\n + FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand\r\n\r\nAdd-Type : (5) : The type 'Console' exists in both 'System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and\r\n'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'\r\n(4) : public static void Test() {\r\n(5) : >>> System.Console.BackgroundColor = (System.Console.ConsoleColor) -1;\r\n(6) : }\r\nAt line:1 char:1\r\n+ Add-Type -TypeDefinition $source -Language CSharp -ReferencedAssembli ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception\r\n + FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand\r\n\r\nAdd-Type : Cannot add type. Compilation errors occurred.\r\nAt line:1 char:1\r\n+ Add-Type -TypeDefinition $source -Language CSharp -ReferencedAssembli ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException\r\n + FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand\r\n```\r\n## Environment data\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n``` powershell\r\n> $PSVersionTable\r\nName Value\r\n---- -----\r\nPSVersion 5.1.10032.0\r\nPSEdition PowerShellCore\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion 3.0.0.0\r\nGitCommitId v6.0.0-alpha.7\r\nCLRVersion\r\nWSManStackVersion 3.0\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\n\r\n```\r\n\r\n/cc @vors \r\n","author":{"url":"https://github.com/andyleejordan","@type":"Person","name":"andyleejordan"},"datePublished":"2016-08-02T22:21:57Z","url":"https://github.com/PowerShell/PowerShell/issues/1616"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e8f9c626-bbd3-47dd-2296-69ca72a71813 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 84A2:34A55:116154:18A7B1:6AFD5DB6 |
| html-safe-nonce | b108e26a67a99ba7845b0abfb41bfeeab942aed1df264c42e58e4f0660472a03 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NEEyOjM0QTU1OjExNjE1NDoxOEE3QjE6NkFGRDVEQjYiLCJ2aXNpdG9yX2lkIjoiODcxMzI1NjE2MTU2MzcyOTMzNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4d9b6122bbb15557a270efa9119ff323df80d6f6efa7cdbe716c02b75bbc2ab3 |
| hovercard-subject-tag | issue:169003128 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/1616/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9f1ed2ba11c0a55e2dccf3228051304076a722bc0bbf8c060b7899e59988e711/PowerShell/PowerShell/issues/1616 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9f1ed2ba11c0a55e2dccf3228051304076a722bc0bbf8c060b7899e59988e711/PowerShell/PowerShell/issues/1616 |
| og:image:alt | Steps to reproduce $source = @" using System; namespace Foo { public static class Bar { public static void Test() { Console.BackgroundColor = (Console.ConsoleColor) -1; } } } "@ Add-Type -TypeDefin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | andyleejordan |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width