-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Microsoft.VisualBasic.Strings.Left(String, Int32) crashes with null ref when length is negative #20271
Comments
That would happen if I had accdientally removed it this morning, but I don't think I did:
Do you see it in src/Microsoft.VisualBasic/src/Resources/Strings.resx? |
It's odd it's using |
Does it repro if yo usync before (or temporily revert) 6b4423? If so I'l take a look. |
Possibly related dotnet/buildtools#1256 |
@danmosemsft Any update on the resource issue? |
I didn't have a chance to debug but I guess to reach this code you had to add ref\Microsoft.VisualBasic.cs
|
I notice in https://github.com/dotnet/corefx/issues/14300#issuecomment-284763018 @AnthonyDGreen says we don't want to port these. If you'd like to propose we should, do add your thoughts in that issue. Meantime let me know if you hit this when using an current public API. |
@danmosemsft Not really. As a (former) SDET I'm quite happy to resort to reflection (and I know that changing the public API is subject to an approval process). But given your last comment and @AnthonyDGreen's statement I'll remove EDIT: Spoke too soon. The method is currently used by |
@dennisdietrich yes we definitely should debug this, it might be a few days (again) unless you get to it. |
Can I work on this issue and fix Microsoft.VisualBasic.Strings.Left(String, Int32)? |
@danmosemsft |
@dhoehna yes please, I haven't had time and may not for a while. As mentioned above, any new API should go through a process and @AnthonyDGreen but certaily bug fixes would be great. I'll assign to you. thanks! |
@dennisdietrich How were you able to call String.Left from StringsTest? I can't call String.Left because, according to the metadata, Left does not exist. Which is odd. |
@dhoehna for some reason (accident?) Left is in the implementation. I assumed @dennisdietrich added it locally to his ref file as well As I undersatnd it from this comment -- Anthony is the owner of VB -- functions like Left should get compiled-in and aren't needed in .NET Core. The only code we have in Microsoft.VisualBasic is what's needed for some dynamic scenarios. Nevertheless anything that's actually reachable should not fail in this way and if I recall correctly, I found that some others (that are exposed) hit this. That's what I hope you can look into - starting by writing tests for stuff exposed in the ref file. |
@danmosemsft Alright. So, I'll start out by expanding the stringtests class and we can go from there. Sound good? Or am I missing the point? |
Sure, you can add coverage for everything in the ref, which for this class is not much public sealed partial class Strings
{
internal Strings() { }
public static int AscW(char String) { throw null; }
public static int AscW(string String) { throw null; }
public static char ChrW(int CharCode) { throw null; }
} As you can see it's the only thing covered in the whole VB assembly, in fact we have https://github.com/dotnet/corefx/issues/14344 to fix the coverage |
@dhoehna did you get a chance to take a look? |
@danmosemsft I'll be looking at all the feedback today. |
oh wait, wrong issue |
@danmosemsft Yeah. I thought this issue was fixed and merged. Did it not get merged? |
Ah yes dotnet/corefx#18182. Thanks! (If you include a link in your PR, it shows in the isseu) I guess I was wondering whether anyone looked at the resource loading probelm or whether it's real. @ViktorHofer could you have a quick look? |
The test method doesn't even exist anymore: I think we are safe to close. Feel free to reopen if I missed something. |
Repo: Call method with negative Length (e.g.
Strings.Left(string.Empty, -1);
)Expected:
System.ArgumentException
(Argument 'Length' must be greater or equal to zero.)Actual:
System.ArgumentNullException
(Value cannot be null.)Looks like it can't find the resource
Argument_GEZero1
for some reason. Output from a (tweaked) test I'm working on for #19615.The text was updated successfully, but these errors were encountered: