Page 1 of 1

System.NotSupportedException. Message = TypeConverter cannot convert from System.String

Posted: Mon Jun 28, 2021 4:28 am
by SpragueR
This occurs when dynamically loading an assembly that references the Stimulsoft assemblies (version 2021.3.4.0) and the Stimulsoft assemblies are in turn automatically loaded from the same folder as the dynamically loaded assembly.

A 7-Zipped sample project (VS 2019) that reproduces this problem can be found here.
https://drive.google.com/file/d/1gYtHYT ... sp=sharing

Type = System.NotSupportedException
Message = TypeConverter cannot convert from System.String.
Source = System
TargetSite = System.Exception GetConvertFromException(System.Object)
StackTrace = at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
at System.ComponentModel.TypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at Stimulsoft.Base.StiObjectStringConverter.StringToObject(String str, Type type) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Base\StiObjectStringConverter.cs:line 97
at Stimulsoft.Report.StiReportObjectStringConverter.StringToObject2(String str, Type type) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Report\StiReportObjectStringConverter.cs:line 296
at Stimulsoft.Base.Serializing.StiSerializing.DeserializeObject(Object obj, StiPropertyInfoCollection props) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Base\Serializing\StiSerializing.cs:line 1059
at Stimulsoft.Base.Serializing.StiSerializing.DeserializeObject(Object obj, StiPropertyInfoCollection props) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Base\Serializing\StiSerializing.cs:line 958
at Stimulsoft.Base.Serializing.StiSerializing.DeserializeObject(Object obj, StiPropertyInfoCollection props) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Base\Serializing\StiSerializing.cs:line 958
at Stimulsoft.Base.Serializing.StiSerializing.DeserializeObject(Object obj, StiPropertyInfoCollection props) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Base\Serializing\StiSerializing.cs:line 958
at Stimulsoft.Base.Serializing.StiSerializing.Deserialize(Object obj, Stream stream, String application) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Base\Serializing\StiSerializing.cs:line 1218
at Stimulsoft.Report.SaveLoad.StiXmlReportSLService.Load(StiReport report, Stream stream) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Report\SaveLoad\StiXmlReportSLService.cs:line 97
at Stimulsoft.Report.StiReport.Load(StiReportSLService service, Stream stream) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Report\StiReport.SaveLoad.cs:line 1607
at Stimulsoft.Report.StiReport.Load(Stream stream) in D:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Report\StiReport.SaveLoad.cs:line 1471

Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String

Posted: Tue Jun 29, 2021 8:59 pm
by Lech Kulikowski
Hello,

Could not load file or assembly 'file:...StimulsoftReports\bin\Debug\CompanyABC.StimulsoftReports.dll' or one of its dependencies. The system cannot find the file specified.'

Thank you.

Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String

Posted: Wed Jun 30, 2021 7:10 am
by SpragueR
Hi Lech,

Ensure that the StimulsoftReports project is built before running the WindowsFormsApp1 project; Build -> Build Solution.

As the WindowsFormsApp1 project does not reference the StimulsoftReports project directly (in button1_Click it loads the assembly dynamically), VS will not rebuild the StimulsoftReports project before running the WindowsFormsApp1 project.

Then read the comments in button2_Click to uncomment two lines of code and run the “same” logic but not loading the assembly dynamically.

Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String

Posted: Wed Jun 30, 2021 7:13 am
by SpragueR
Hi Lech,

In the forums others have reported this same exception previously but you have never been able to reproduce the problem in your test environment.
I believe the project I provided will allow you to reproduce this problem.

Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String

Posted: Fri Jul 02, 2021 10:54 am
by Lech Kulikowski
Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.

Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String

Posted: Sat Jul 03, 2021 8:19 am
by SpragueR
Noted. Thanks for the update.

Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String

Posted: Mon Jul 05, 2021 7:55 am
by Lech Kulikowski
Hello,

Unfortunately, we can not fix this.
We use the TypeConverter functionality in many places, e.g. loading/saving reports with it. Due to the peculiarities of Net Framework implementation, this does not work correctly if assemblies are not loaded explicitly or from the application folder. This is a feature of NetFramework, there is nothing we can do. Sorry.

Thank you.

Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String

Posted: Mon Jul 05, 2021 6:58 pm
by SpragueR
Hi Lech,

Noted. Thanks for the quick response.

Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String

Posted: Tue Jul 06, 2021 6:13 am
by Andrew
Hello,

You are welcome!