Reputation: 29
Dim A As String = Chr(128)
Vb accepts 0 to 255 as acceptable values for Chr() but C# breaks the code with a fatal error if the value is above 127.
Why? Why does C# break the code inside the VB.Net DLL?
What other VB functions are affected by C#?
========== Thanks to Charlyface for asking me to add the full exception message. I had been looking at the error the DLL was raising in C# but not the one in VB. The error has given me an idea for the solution...
Upvotes: 0
Views: 135
Reputation: 29
Solution to problem.
Upgrade project to .NET 6 (https://dotnet.microsoft.com/en-us/platform/upgrade-assistant/tutorial/install-upgrade-assistant)
Add System.Text.Encoding.CodePages
NuGet package to solution
Register encoding in startup.
Create a global variable (Encod in the sample) and assign to encoding in startup
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance)
Encod = Encoding.GetEncoding(1252)
Upvotes: 1