Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7931179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:38:38+00:00 2026-06-03T20:38:38+00:00

Starting from this Question I discovered that using the powershell.exe.config to load .net Framework

  • 0

Starting from this Question I discovered that using the powershell.exe.config to load .net Framework 4.0 runtime, this code:

$word = "Thisisatest"
[System.String]::Join("-", $word.ToCharArray())

return System.Char[]

Executing Powershell w/o powershell.exe.config the same code works in the right way.

Someone can reproduce this issue and explain why??

My box is windows 7 pro with Powershell 2.0

Edit: my powershell.exe.config

<?xml version="1.0"?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
         <supportedRuntime version="v4.0.30319"/>        
         <supportedRuntime version="v2.0.50727"/>        
    </startup>
</configuration>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:38:39+00:00Added an answer on June 3, 2026 at 8:38 pm

    This is due to the new overloads to string.Join added in version 4 of the .NET framework:

    PS> [Environment]::Version.ToString()
    2.0.50727.5456
    PS> [string]::Join.OverloadDefinitions
    static string Join(string separator, string[] value)
    static string Join(string separator, string[] value, int startIndex, int count)
    

    PS> [Environment]::Version.ToString()
    4.0.30319.269
    PS> [string]::Join.OverloadDefinitions
    static string Join(string separator, Params string[] value)
    static string Join(string separator, Params System.Object[] values)
    static string Join[T](string separator, System.Collections.Generic.IEnumerable[T] values)
    static string Join(string separator, System.Collections.Generic.IEnumerable[string] values)
    static string Join(string separator, string[] value, int startIndex, int count)
    

    In .NET 2.0, the only applicable method overload takes a string[] as the second argument, so each character from $word.ToCharArray() is coerced to a string.

    PS> Trace-Command *Member* { [string]::Join( "-", $word.ToCharArray() ) } -PSHost
    ...
    MemberResolution: Method argument conversion.
    MemberResolution:     Converting parameter "-" to "System.String".
    MemberResolution: Method argument conversion.
    MemberResolution:     Converting parameter "System.Char[]" to "System.String[]".
    MemberResolution: Calling Method: static string Join(string separator, string[] value)
    

    In .NET 4, the object[] overload is preferred. Rather than boxing each character, the entire array is coerced to an object, sending a single-element object array to string.Join, which then has ToString called to produce the "System.Char[]" output.

    Method argument conversion.
        Converting parameter "-" to "System.String".
    Method argument conversion.
        Converting parameter "System.Char[]" to "System.Object".
    Method argument conversion.
        Converting parameter "System.Object[]" to "System.Object[]".
    Calling Method: static string Join(string separator, Params System.Object[] values)
    

    To get the old behavior, you can insert a [string[]] cast to influence how the method is resolved (or in this case just use PowerShell’s -join operator, which works correctly everywhere :).

    PS> $word = 'test'
    PS> [string]::Join( '-', $word.ToCharArray() )
    System.Char[]
    PS> [string]::Join( '-', [string[]]$word.ToCharArray() )
    t-e-s-t
    PS> [char[]]$word -join '-'
    t-e-s-t
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Starting from this official statement that all xyAndroid versions previous API 11 doesn't support
Further to this question: MySQL - Conditional COUNT with GROUP BY Starting from the
I have a linked list question that stems from this homework prompt I am
Starting a new question from this thread, Can anyone answer why a ComboBox with
Let me try to ask this question from a different angle. I noticed that
Starting from Android 3.2 I have this strange problem. It's very easy to reproduce:
Starting from scratch with very little knowledge of .NET, how much ASP.NET should I
Windows provides only GetTickCount up to Windows Vista and starting from that OS also
From my previous question for selecting specific html text, I have gone through this
I face a very serious situation. By writing this question I hope that really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.