Excel-DNA / Excel-DNA/ExcelDna
Beta UTF-8 region setting with Chinese language displays DnaLibrary AutoOpen "Memory" warning
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 292
- Avg merge
- 20d 12h
- Merged PRs (30d)
- 1
Description
### Discussed in https://github.com/Excel-DNA/ExcelDna/discussions/586
Originally posted by **eutiquiorg** April 4, 2023
Hello there!
We have an add-in added to Excel and when we open Excel under the conditions described below (Steps to reproduce), a "Memory" warning is displayed and then we cannot use the available functions of our add-in.
We create a simple ClassLibrary project to reproduce our problem in Visual Studio 2022 (having Visual Studio in Chinese and having the "Steps to reproduce").

Class1.cs
'namespace MyClassProject
{
[ComVisible(true)]
public class MyComAddIn : ExcelComAddIn
{
public MyComAddIn()
{
}
public override void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
{
SWF.MessageBox.Show("OnConnection");
}
public override void OnDisconnection(ext_DisconnectMode RemoveMode, ref Array custom)
{
SWF.MessageBox.Show("OnDisconnection");
}
public override void OnAddInsUpdate(ref Array custom)
{
SWF.MessageBox.Show("OnAddInsUpdate");
}
public override void OnStartupComplete(ref Array custom)
{
SWF.MessageBox.Show("OnStartupComplete");
}
public override void OnBeginShutdown(ref Array custom)
{
SWF.MessageBox.Show("OnBeginShutDown");
}
}
public class MyAddIn : IExcelAddIn
{
private ExcelComAddIn _comAddIn;
public void AutoOpen()
{
try
{
_comAddIn = new MyComAddIn();
ExcelComAddInHelper.LoadComAddIn(_comAddIn);
}
catch (Exception e)
{
SWF.MessageBox.Show("Error loading COM AddIn: " + e.ToString());
}
}
public void AutoClose()
{
}
}
}`
MyClassProject.csproj

We debug the code and when the debugger reaches ExcelComAddInHelper.LoadComAddIn(_comAddIn); the "Memory" warning is displayed as below picture.

Click on Continue and the following Exception is raised.

This behavior occurs when we enable "Beta: Use Unicode UTF-8 for worldwide language support" option in the Region Settings and set the Windows language and Office language to Chinese (See "Steps to reproduce").
**Steps to reproduce:**
1. Set the Regional format to "Chinese (Simplified, China)", as below picture

2. Set the Region setting to use "Beta: Use Unicode UTF-8 for worldwide language support", and the Current system locale option as "Chinese (Simplified, China), as below picture

3. Set Excel as Chinese language in the File-> Options->Language -> Office display language as Chinese (Simplified), as below picture

4. Set Windows Display as Chinese

5. Restart Windows 10 system
6. Run the simple ClassLibrary project, you will see the "Memory" warning.
We appreciate your help with this issue.
Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.