System.InvalidCastException Occurs When Loading PowerPoint Presentation in C#

Hi,

Recently, a large number of clients have reported that their slides files cannot be processed. The error message is as follows. Please provide some assistance. Thank you.
I got System.InvalidCastException:Unable to cast object of type 'System.Int32' to type 'System.String'. when saving a slide.

Test Info

Using SDK: Aspose.Slides for .Net 24.10 and 26.2.
Tested OSs were Win7 and Win10
.NET target platform is .net 6.0

Test code

Presentation document = new Aspose.Slides.Presentation("【58】2026届8省名师联合命制高考领航卷数学(六)(只读模式).ppt");

Test file:

【58】2026届8省名师联合命制高考领航卷数学(六)(只读模式).7z (981.7 KB)

Exception detail:

System.InvalidCastException
  HResult=0x80004002
  Message=Unable to cast object of type 'System.Int32' to type 'System.String'.
  Source=Aspose.Slides
  StackTrace:
   在 .(IDictionary`2 , RegistryKey , String )
   在 .(IDictionary`2 )
   在 .(ICollection`1 )
   在 .()
   在 .(String , FontStyle )
   在 .( , Boolean )
   在 .( , Boolean , Single ,  , Int32 , Boolean )
   在 .( , String ,  , Int32 , Single , FontStyle , Boolean )
   在 .(String ,  , Int32 , Single , FontStyle , Boolean )
   在 .()
   在 e.(ee& , Boolean& )
   在 .()
   在 ..ctor(TextFrame ,  , IBaseSlide ,  , [] )
   在 e.e( ,  )
   在 e.e( )
   在 e.(Boolean )
   在 Aspose.Slides.Shape.get_Frame()
   在 .(e )
   在 .(e )
   在 .(e )
   在 e.(e )
   在 .(e )
   在 .()
   在 .( , InterruptionToken )
   在 Aspose.Slides.Presentation.( )
   在 Aspose.Slides.Presentation.(Stream , Boolean )
   在 Aspose.Slides.Presentation.(String , Boolean )
   在 Program.<<Main>$>g__testUnlockppt|0_3(String filename) 在 Z:\DEV\.NET\ConsoleApp.Slides\ConsoleApp2\Program.cs 中: 第 36 行
   在 Program.<Main>$(String[] args) 在 Z:\DEV\.NET\ConsoleApp.Slides\ConsoleApp2\Program.cs 中: 第 42 行

@kngstr,
Thank you for contacting free support. I need some time to investigate the issue. I will get back to you as soon as possible.

My clients are also experiencing the same issue, but my application is Windows + .NET Framework 4.7. The strange things are:

  1. This error occurs even with very old versions.

  2. This error did not reproduce on my own computer or after reinstalling the latest version of Windows 11 25H2.

  3. This problem has been frequently reported in the last two weeks; it has never occurred before.

Therefore: I suspect it might be related to Windows system patch updates; some users experience the problem, while others do not. It’s most likely related to font rendering.

Furthermore, how can you resolve this issue? Releasing 26.x as a new fix might not be suitable for us older users, as we are not continuous subscribers. And this issue seems to affect all versions.

@xxtears

Yes. And even the latest SDK version.

Yes. Too many clients in the last two weeks. The same to us. It never occurred before.

This issue occurs in Windows 7, 10, 11. But not all the same Windows version can reproduce this issue.
So we don’t think it’s related to Windows patches or updates.

We do think so.

We are trying to fix this ourselves. Today we finnally found a computer can reproduce this issue.
But if Aspose can provide us a fix, that will be better.

@xxtears, @kngstr,
Thank you for the notes. I will get back to you as soon as possible.

@kngstr,
Unfortunately, I was unable to reproduce the error you described. Please check the issue carefully, isolate the problem, and share more details on how to reproduce the error on our side.

@andrey.potapov We are trying to identify the key issue.
If we find that, can we get a fix for this issue?
Our subscription has expired.

@kngstr,
After we reproduce the problem on our side, our developers will do their best to resolve it, but you may need to update your Aspose.Slides version.

@andrey.potapov
We have identified the problem.
When SDK read the registry, it was caused by incorrect handling of data types.
Can I use this registry to get a free new version?

@kngstr,
I am not sure that I understand your question. Could you please clarify what you mean?

I think this is a serious issue, and we are also paid Aspose users. Perhaps you’ve set a specific time to trigger this in your code? This is just a guess, but our users have indeed been receiving this issue over the past two weeks, something that has never happened before. Maybe it will automatically return to normal after two weeks.

@xxtears,
Aspose.Slides does not have any specific time-based logic that could trigger this behavior after a certain period. In other words, there is no built-in mechanism in Aspose.Slides that would start causing this issue after two weeks and then automatically return to normal later. If this problem started appearing recently, it is more likely related to the environment, input files, application logic, or some external factor. Please let us know if you can provide more details so that we can reproduce the issue on our side.

@andrey.potapov
What I mean is, can we use this detailed information to obtain a license for a new version?

We have also confirmed that the issue is caused by third-party software.
The content that should not have appeared led to this issue.

@kngstr,
Unfortunately, Aspose does not provide a licensing option for this scenario.

Even though we understand that the issue was caused by third-party software, this does not constitute grounds for issuing a new license for a newer product version.

If you need to use a newer version, a valid license or subscription that covers that version would still be required.

@andrey.potapov OK. Thanks for your answer.
We fixed this by ourselves.

@kngstr Could it be the influence of WPS? Could you share your repair plan? I can pay.

@xxtears This issue has nothing to do with WPS or Office.
It’s due to third-party software writing in content that shouldn’t be there.
And the code of Aspose is not strong.
If you have QQ, you can join a QQ group:1016277369.
If not, you can send email to kngstr@outlook.com.

@kngstr @xxtears @andrey.potapov
We’ve also encountered this problem recently. Could you please tell us how to solve it?

@qianshen,
Unfortunately, we were unable to reproduce the issue on our side. We would greatly appreciate it if you could share additional details (sample files, a code example, and an environment description) so that we can investigate further. We will then do our best to help you.