soukoku / ntwain

A TWAIN lib for dotnet.
MIT License
117 stars 47 forks source link

TWIdentity.CreateFromAssembly throws ArgumentException whenever the referenced assembly's ProductName is longer than 33 chars #26

Open vonzshik opened 2 years ago

vonzshik commented 2 years ago
The string value has exceeded the maximum length allowed.

at NTwain.Internals.Extensions.VerifyLengthUnder(String value, Int32 maxLength) in C:\Users\vonzs\Downloads\ntwain-3\src\NTwain\Internals\Extensions.cs:line 20
   at NTwain.Data.TWIdentity.set_ProductFamily(String value) in C:\Users\vonzs\Downloads\ntwain-3\src\NTwain\Data\TwainTypesExtended.cs:line 1727
   at NTwain.Data.TWIdentity.Create(DataGroups supportedGroups, Version version, String manufacturer, String productFamily, String productName, String productDescription) in C:\Users\vonzs\Downloads\ntwain-3\src\NTwain\Data\TwainTypesExtended.cs:line 1775
   at NTwain.Data.TWIdentity.CreateFromAssembly(DataGroups supportedGroups, Assembly assembly) in C:\Users\vonzs\Downloads\ntwain-3\src\NTwain\Data\TwainTypesExtended.cs:line 1750

Maybe NTwain could just call Substring on them, instead of throwing an exception?