System.NotSupportedException. Message = TypeConverter cannot convert from System.String
System.NotSupportedException. Message = TypeConverter cannot convert from System.String
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
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
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String
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.
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
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.
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
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.
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.
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String
Hello,
We need some additional time to investigate the issue, we will let you know about the result.
Thank you.
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
Noted. Thanks for the update.
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String
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.
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
Hi Lech,
Noted. Thanks for the quick response.
Noted. Thanks for the quick response.
Re: System.NotSupportedException. Message = TypeConverter cannot convert from System.String
Hello,
You are welcome!
You are welcome!