Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.String.Replace fails with NotImplementedException #20948

Closed
marek-safar opened this issue Mar 19, 2021 · 11 comments
Closed

System.String.Replace fails with NotImplementedException #20948

marek-safar opened this issue Mar 19, 2021 · 11 comments

Comments

@marek-safar
Copy link
Member

The netstandard 2.1 introduced a new overload of String.Replace which fails with NIE.

System.NotImplementedException: The method or operation is not implemented.\n 
at System.Globalization.CompareInfo.IndexOfCore (System.String source, System.String target, System.Int32 startIndex, System.Int32 count, System.Globalization.CompareOptions options, System.Int32* matchLengthPtr) [0x00006] in <0259240c66b143c79f181dc836ac854f>:0 \n 
at System.Globalization.CompareInfo.IndexOf (System.String source, System.String value, System.Int32 startIndex, System.Int32 count, System.Globalization.CompareOptions options, System.Int32* matchLengthPtr) [0x00071] in <0259240c66b143c79f181dc836ac854f>:0 \n 
at System.String.ReplaceCore (System.String oldValue, System.String newValue, System.Globalization.CultureInfo culture, System.Globalization.CompareOptions options) [0x0005d] in <0259240c66b143c79f181dc836ac854f>:0 \n 
at System.String.Replace (System.String oldValue, System.String newValue, System.StringComparison comparisonType) [0x00055] in <0259240c66b143c79f181dc836ac854f>:0 \

This should be quite easy to fix at

throw new NotImplementedException ();
by adopting corert logic https://github.com/mono/corert/blob/11136ad55767485063226be08cfbd32ed574ca43/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.Dummy.cs#L65-L66

@steveisok

@terrajobst
Copy link
Member

Is that related to some of our globalization work? @tarekgh

@tarekgh
Copy link
Contributor

tarekgh commented Mar 22, 2021

Is that related to some of our globalization work?

What exactly that work? do you mean the Globalization Invariant and the linker? or something else?

@terrajobst
Copy link
Member

Sorry, I meant the work we did for using ICU.

@steveisok
Copy link
Contributor

Is that related to some of our globalization work? @tarekgh

Mono doesn't use ICU. This is a gap we need to fill from our past NS 2.1 work.

@terrajobst
Copy link
Member

Do we know why this API throws? Is it because of ICU or unrelated?

@steveisok
Copy link
Contributor

Unrelated. Just looks like something we missed.

@MaximLipnin
Copy link
Contributor

Closing as fixed

@terrajobst
Copy link
Member

What release will the fix be in?

@marek-safar
Copy link
Member Author

I believe Xamarin should pick up the fix in the next service release for Visual Studio 2019 v16.9

/cc @jonpryor @dalexsoto

jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Apr 14, 2021
Context: mono/mono#20948
Context: mono/mono#20982

Changes: mono/mono@eb4c311...b4a3858

  * mono/mono@b4a385816ed: Bump fsharp.py to get upstream nuget feed cleanup
  * mono/mono@225ba3c8cb1: [2020-02] Backport r4-conv-i fixes (#20986)
  * mono/mono@fcbc4559359: [ci] Use adoptopenjdk instead of zulu-8 in sdks-archive.groovy
  * mono/mono@cc8b25a7d86: [2020-02] Bump msbuild, roslyn and nuget (#20983)
  * mono/mono@8c331833c72: Disable JSC runs on WASM since it crashes
  * mono/mono@69cfb5fa61a: Fix the System.String.Replace throwing NotImplementedException (#20960) (#20978)
jonpryor added a commit to xamarin/xamarin-android that referenced this issue Apr 14, 2021
Context: mono/mono#20948
Context: mono/mono#20982

Changes: mono/mono@eb4c311...b4a3858

  * mono/mono@b4a385816ed: Bump fsharp.py to get upstream nuget feed cleanup
  * mono/mono@225ba3c8cb1: [2020-02] Backport r4-conv-i fixes (#20986)
  * mono/mono@fcbc4559359: [ci] Use adoptopenjdk instead of zulu-8 in sdks-archive.groovy
  * mono/mono@cc8b25a7d86: [2020-02] Bump msbuild, roslyn and nuget (#20983)
  * mono/mono@8c331833c72: Disable JSC runs on WASM since it crashes
  * mono/mono@69cfb5fa61a: Fix the System.String.Replace throwing NotImplementedException (#20960) (#20978)
@BenBtg
Copy link

BenBtg commented May 11, 2021

FYI This is still not working for me in 16.10.0 Preview 2.1

@vinagesh
Copy link

@BenBtg - This works for me in Version 16.10.0 Preview 4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants