We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to SetLicense on Xamarin.iOS when using SDK Linking

Aspose: Aspose.Words .NET (version 21.8.0)
Platforms: Xamarin.iOS, Xamarin.Android, & Xamarin.Forms (iOS & Android)
Build Config: Linking set to Link Framework SDKs Only

When calling SetLicense() the following error is thrown. It works fine when set to Don't Link.

**System.TypeLoadException:** 'Cannot load type 'System.IDisposable, netstandard, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.'

aspose-idisposable-error.PNG (11.3 KB)

Additional Notes/Speculation:
- Our license file is stored as an embedded resource in the Xamarin.iOS or Xamarin.Android native projects.
- Microsoft.Win32.Registry.dll may be the culprit. It is also causing compile-time linking errors (which we worked around by adding the --dlsym:Microsoft.Win32.Registry.dll mtouch arg).
- With SDK Linking enabled, a couple artifacts were missing and we needed to add them to the linker config to force inclusion (XmlDocument.GetElementsByTagName() & Assembly.GetEntryAssembly())

We also setup a small sample project with only Xamarin and Aspose,Words packages to reproduce this issue and ensure nothing else was interfering. I can recreate the issue by simply adding Aspose.Words & the license file to a Xamarin project, then calling License.SetLicense().

@8botdev I have logged this issue in our defect tracking system as WORDSNET-22576. We will keep you informed and let you know once the issue is resolved.

1 Like

Could you give a tentative timeline for the fix please?

@KrishnaK I will analyze the issue deeper and provide you an estimate or workaround for this issue.

Thank you so much Alexey.


@KrishnaK @8botdev The problem occurs because Linker removes some classes required by Aspose.Words, most likely because they are hidden from Linker by obfuscation of the library. To overcome this you can add linker configuration file like the following into your project:

      <assembly fullname="mscorlib">
        <type fullname="*" />
      <assembly fullname="netstandard">
        <type fullname="*" />

Please see the following article to learn more about linker configuration file:

Please, let me know if the proposed solution is acceptable for you, if so I will close the issue as Not a Bug.

The issues you have found earlier (filed as WORDSNET-22576) have been fixed in this Aspose.Words for .NET 21.9 update.