Title: The first array type in a generic method doesn't work · Issue #18686 · PowerShell/PowerShell · GitHub
Open Graph Title: The first array type in a generic method doesn't work · Issue #18686 · PowerShell/PowerShell
X Title: The first array type in a generic method doesn't work · Issue #18686 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/18686
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The first array type in a generic method doesn't work","articleBody":"### Prerequisites\n\n- [X] Write a descriptive title.\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [X] Search the existing issues.\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nWhen I try to flatten a two-dimensional array by `Enumerable.SelectMany` method with generic type arguments, the first type argument `int[]` may not be treated correctly.\r\n```powershell\r\n[Linq.Enumerable]::SelectMany[int[], int](\r\n [int[][]] @((,2), (,4), (,6), (,8)),\r\n [Func[[int[]], int[]]] { param ($x); $x }\r\n) | ConvertTo-Json -Compress\r\n```\n\n### Expected behavior\n\n```console\n[2,4,6,8]\n```\n\n\n### Actual behavior\n\n```console\nUnable to find type [int,int].\n```\n\n\n### Error details\n\n```console\nException :\r\n Type : System.Management.Automation.RuntimeException\r\n ErrorRecord :\r\n Exception :\r\n Type : System.Management.Automation.ParentContainsErrorRecordException\r\n Message : Unable to find type [int,int].\r\n HResult : -2146233087\r\n TargetObject : int,int\r\n CategoryInfo : InvalidOperation: (int,int:TypeName) [], ParentContainsErrorRecordException\r\n FullyQualifiedErrorId : TypeNotFound\r\n InvocationInfo :\r\n ScriptLineNumber : 2\r\n OffsetInLine : 31\r\n HistoryId : -1\r\n Line : [Linq.Enumerable]::SelectMany[int[], int](\r\n\r\n PositionMessage : At line:2 char:31\r\n + [Linq.Enumerable]::SelectMany[int[], int](\r\n + ~~~~~\r\n CommandOrigin : Internal\r\n ScriptStackTrace : at \u003cScriptBlock\u003e, \u003cNo file\u003e: line 2\r\n TargetSite :\r\n Name : ResolveTypeName\r\n DeclaringType : System.Management.Automation.TypeOps, System.Management.Automation, Version=7.3.0.500, Culture=\r\nneutral, PublicKeyToken=31bf3856ad364e35\r\n MemberType : Method\r\n Module : System.Management.Automation.dll\r\n Message : Unable to find type [int,int].\r\n Data : System.Collections.ListDictionaryInternal\r\n Source : System.Management.Automation\r\n HResult : -2146233087\r\n StackTrace :\r\n at System.Management.Automation.TypeOps.ResolveTypeName(ITypeName typeName, IScriptExtent errorPos)\r\n at System.Management.Automation.TypeOps.ResolveTypeName(ITypeName typeName, IScriptExtent errorPos)\r\n at System.Management.Automation.Adapter.ResolveGenericTypeParameters(Object[] genericTypeParameters)\r\n at System.Management.Automation.Adapter.FindBestMethodImpl(MethodInformation[] methods, PSMethodInvocationConstraint\r\ns invocationConstraints, Boolean allowCastingToByRefLikeType, Object[] arguments, String\u0026 errorId, String\u0026 errorMsg, Bo\r\nolean\u0026 expandParamsOnBest)\r\n at System.Management.Automation.Adapter.FindBestMethod(MethodInformation[] methods, PSMethodInvocationConstraints in\r\nvocationConstraints, Boolean allowCastingToByRefLikeType, Object[] arguments, String\u0026 errorId, String\u0026 errorMsg, Boolea\r\nn\u0026 expandParamsOnBest, Boolean\u0026 callNonVirtually)\r\n at System.Management.Automation.Language.PSInvokeMemberBinder.InvokeDotNetMethod(CallInfo callInfo, String name, PSM\r\nethodInvocationConstraints psMethodInvocationConstraints, MethodInvocationType methodInvocationType, DynamicMetaObject\r\ntarget, DynamicMetaObject[] args, BindingRestrictions restrictions, MethodInformation[] mi, Type errorExceptionType)\r\n at System.Management.Automation.Language.PSInvokeMemberBinder.FallbackInvokeMember(DynamicMetaObject target, Dynamic\r\nMetaObject[] args, DynamicMetaObject errorSuggestion)\r\n at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection`1 parameters, LabelTarget returnLab\r\nel)\r\n at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T](CallSite`1 site, Object[] args)\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)\r\n at System.Management.Automation.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)\r\n at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)\r\nTargetObject : int,int\r\nCategoryInfo : InvalidOperation: (int,int:TypeName) [], RuntimeException\r\nFullyQualifiedErrorId : TypeNotFound\r\nInvocationInfo :\r\n ScriptLineNumber : 2\r\n OffsetInLine : 31\r\n HistoryId : -1\r\n Line : [Linq.Enumerable]::SelectMany[int[], int](\r\n\r\n PositionMessage : At line:2 char:31\r\n + [Linq.Enumerable]::SelectMany[int[], int](\r\n + ~~~~~\r\n CommandOrigin : Internal\r\nScriptStackTrace : at \u003cScriptBlock\u003e, \u003cNo file\u003e: line 2\n```\n\n\n### Environment data\n\n```powershell\nName Value\r\n---- -----\r\nPSVersion 7.3.0\r\nPSEdition Core\r\nGitCommitId 7.3.0\r\nOS Microsoft Windows 10.0.22621\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\n```\n\n\n### Visuals\n\n_No response_","author":{"url":"https://github.com/InSb","@type":"Person","name":"InSb"},"datePublished":"2022-11-30T16:04:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/18686/PowerShell/issues/18686"}
| 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:ef1d3f36-8f0f-4c34-ae96-fd6d9ad32a6a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3E2:35AF44:1FE2336:2AA9251:6A54640D |
| html-safe-nonce | b54749049e9bef1775178aebe2a79ad4a9b5ea86288ce320a0c15b224e25348a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0UyOjM1QUY0NDoxRkUyMzM2OjJBQTkyNTE6NkE1NDY0MEQiLCJ2aXNpdG9yX2lkIjoiMzc1ODg1OTc1MTc5NjI3MDA5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e413e43661a61e7c4e3ed1f7326935d43da6abceae8dbcd181d21ac0c7811cbf |
| hovercard-subject-tag | issue:1469875152 |
| 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/18686/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d6f9f3862628248a183ff782e8cc6eb319281b591470524dd1990b574257f6fa/PowerShell/PowerShell/issues/18686 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d6f9f3862628248a183ff782e8cc6eb319281b591470524dd1990b574257f6fa/PowerShell/PowerShell/issues/18686 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | InSb |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 6d28624802c2f7d9500239dd6870ed7031b7353b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width