-
Notifications
You must be signed in to change notification settings - Fork 272
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
Method not found: System.String System.String.TrimStart() exception #850
Comments
Hi @halcwb , Have you tried your application with .NET Core 3.1 instead of .NET 5? Do you get the same And another thing you can try is to comment out all the Microsoft.Data.SqlCient related stuff and just call String.TrimStart() in your application to see whether you still get the exception or not. Thanks, |
@karinazhou. Thanks for the quick reply:
The problem is the dependency resolution using FSI. But not being able to use the FSI is a real pain for an F# developer (at least for me), as it enables me to quickly develop in a REPL cycle. I also tried using net472, but then I get (with the AppContext.SetSwitch):
|
OK, at last I got it working again:
So, I can't get it running using a netcore version. |
@halcwb Thank you for the update. Yes, Though I am not familiar with F# application, it is surprising that the driver doesn't work with .net core version. If you can share a simple sample app that just opens a connection to SQL Server, we can help to look into it and see why it doesn't work for .net core. |
@halcwb just to make it more clear, I have created an F# application as simple as this :
I tried this with net5.0, netcoreapp3.1 and net48 and all worked without any issue. Am I missing something? |
@JRahnama. Thanks for looking into this, and you are completely right, in compiled code everything works. But as an F# developper I typically write my code in a script file. This enables quickly running pieces of code and exploring possibilities. So when you run the code in a script file you need to reference all necessary libraries. Normally this is without a problem, but when libraries depend on local copied other libraries, this fails (or you not to manually figure out what to copy where). So there is no bin folder where everything is put and run from. So, the problem is trying to use the library from an F# script file. |
@halcwb Can you try your code with this PR. On some other notes, can you tell me how you run your F# script against
That did not throw any exception. |
Even I tried and could not reproduce with both netstandard and netcore: Enabling App Context switch has not effect too and no issues found:
Also not reproducible with standard F# Console Apps. All target frameworks work fine! Can you explain more about your target server so we can confirm we're testing similar env?
|
@cheenamalhotra and @JRahnama. Thanks for taking so much trouble to look into this! I think the main confusion is that I use the FSI available in VS or VSCode. Secondly, indeed with the new The only available option to directly reference dependencies in a F# script file has been for years paket, With paket you can generate load scripts with the obvious command I think the whole issue boils down to how the nuget files are arranged and referenced in the script. I realize this isn't directly related to Microsoft.Data.SqlClient, but I am very curious why |
Could you try the fix from #859 to see it it resolves your issue? |
@cheenamalhotra I am terribly sorry that I didn't reply sooner, while you are trying to help me. My apologies. It's just that I am also very busy and don't have the immediate time to start checking. Hoop I will be able to do that next week. |
No problem, let us know when you happen to test the change. |
I can confirm that using the fsi directly with I guess I have to wait for better FSI support using the new net5.0. |
Describe the bug
Completely out of the blue I am no longer able to use the SqlDataClient in a script file getting the below error. I had previously problems to get things up and running, but managed it with setting the reference to the runtimes/win SqlDataClient dll and
See: #645.
Then suddenly out of the blue I get the below error:
To reproduce
And I get the error.
And just to be sure, I also copied a runtime nsi dll to the nuget cache folder for the runtime SqlDataClient.
Expected behavior
The connection to be created.
Further technical details
.NET SDK (reflecting any global.json):
Version: 5.0.100
Commit: 5044b93829
Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100\
Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7
.NET SDKs installed:
2.1.701 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.2.301 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]
3.1.301 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
The text was updated successfully, but these errors were encountered: