Telerik Forums
Reporting Forum
1 answer
164 views

When we try to process a report from a .NET 6 application, there is an exception
 "BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information."
Version used: Telerik R1 2023 SP1

On Telerik forums, there is a workaround to suppress this error, see below:
https://www.telerik.com/forums/aspnetcore-5-support
https://docs.telerik.com/reporting/knowledge-base/binaryformatter-exception-after-upgrade-to-net5
However, based on this post the BinaryFormatter is necessary for serialization and not having it will cause issues with image generation.
Please advise if there is a way to generate reports with images from a .NET 6 app without using EnableUnsafeBinaryFormatterSerialization.

Ivan Ivanov
Telerik team
 answered on 01 Mar 2024
2 answers
137 views

While developing an endpoint (.NET 6 API) to export a PDF from a TRDX file ( no problems here ) I decided to publish to the test environment.

I keep getting this error :

 

2024-02-19T06:04:14.518155356Z System.MissingMethodException: Type: Telerik.Reporting.ReportSerialization.Current.ReportSerializable`1[Telerik.Reporting.Report]
2024-02-19T06:04:14.518227356Z ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
2024-02-19T06:04:14.525815894Z ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
2024-02-19T06:04:14.525839694Z ---> System.TypeInitializationException: The type initializer for 'Telerik.Reporting.Drawing.Unit' threw an exception.
2024-02-19T06:04:14.525845694Z ---> Telerik.Drawing.Contract.DrawingFactoryUnavailableException: Cannot load assembly Telerik.Drawing.Skia. Make sure it is accessible in the current application domain.
2024-02-19T06:04:14.525850094Z at Telerik.Drawing.Contract.DrawingFactory.GetFactoryBase(String factoryTypeName, String factoryAssemblyName, Boolean assemblyLoaded)
2024-02-19T06:04:14.525854594Z at Telerik.Drawing.Contract.DrawingFactory.GetSkiaInstance()
2024-02-19T06:04:14.525858494Z at Telerik.Drawing.Contract.DrawingFactory.TryResolveFromRuntime()
2024-02-19T06:04:14.525862394Z at Telerik.Drawing.Contract.DrawingFactory.ResolveDrawingFactory()
2024-02-19T06:04:14.525866094Z at Telerik.Drawing.Contract.DrawingFactory.CreateDrawingFactory()
2024-02-19T06:04:14.525869694Z at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
2024-02-19T06:04:14.525873394Z at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
2024-02-19T06:04:14.525877094Z at System.Lazy`1.CreateValue()
2024-02-19T06:04:14.525880593Z at System.Lazy`1.get_Value()
2024-02-19T06:04:14.525884293Z at Telerik.Drawing.Contract.DrawingFactory.get_Instance()
2024-02-19T06:04:14.525887893Z at Telerik.Reporting.Drawing.Unit.GetDotsPerInch()
2024-02-19T06:04:14.525891493Z at Telerik.Reporting.Drawing.Unit.ResetDpiSettings()
2024-02-19T06:04:14.525895093Z at Telerik.Reporting.Drawing.Unit..cctor()
2024-02-19T06:04:14.525898593Z --- End of inner exception stack trace ---
2024-02-19T06:04:14.525902093Z at Telerik.Reporting.Drawing.Unit.Cm(Int32 value)
2024-02-19T06:04:14.525924393Z at Telerik.Reporting.Report..ctor()
2024-02-19T06:04:14.525929493Z at System.RuntimeType.CreateInstanceOfT()
2024-02-19T06:04:14.525933093Z --- End of inner exception stack trace ---
2024-02-19T06:04:14.525936593Z at System.RuntimeType.CreateInstanceOfT()
2024-02-19T06:04:14.525940093Z at System.Activator.CreateInstance[T]()
2024-02-19T06:04:14.525943593Z at Telerik.Reporting.ReportSerialization.Current.ReportSerializable`1..ctor(IConvertersContainer converters)
2024-02-19T06:04:14.525947293Z --- End of inner exception stack trace ---
2024-02-19T06:04:14.525950893Z at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
2024-02-19T06:04:14.525954893Z at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2024-02-19T06:04:14.525959993Z at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
2024-02-19T06:04:14.525963993Z at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
2024-02-19T06:04:14.564619278Z at System.Activator.CreateInstance(Type type, Object[] args)
2024-02-19T06:04:14.564649677Z at Telerik.Reporting.Serialization.ObjectReader.CreateInstance(Type type, String name)
2024-02-19T06:04:14.564655577Z --- End of inner exception stack trace ---
2024-02-19T06:04:14.564659977Z at Telerik.Reporting.Serialization.ObjectReader.CreateInstance(Type type, String name)
2024-02-19T06:04:14.564663977Z at Telerik.Reporting.Serialization.ObjectReader.CreateInstance(Type type)
2024-02-19T06:04:14.564668077Z at Telerik.Reporting.Serialization.ObjectReader.ReadObject(Type type)
2024-02-19T06:04:14.564672077Z at Telerik.Reporting.Serialization.ObjectReader.ReadXmlElement(String name)
2024-02-19T06:04:14.564675877Z at Telerik.Reporting.Serialization.ObjectReader.Deserialize(IResourceHandler handler)
2024-02-19T06:04:14.564679577Z at Telerik.Reporting.XmlSerialization.XmlSerializerBase.Deserialize(XmlReader reader, IResourceHandler resourceHandler)
2024-02-19T06:04:14.564683477Z at Telerik.Reporting.XmlSerialization.XmlSerializerBase.Deserialize(Stream stream, IResourceHandler resourceHandler)

2024-02-19T06:04:14.564687177Z at Telerik.Reporting.XmlSerialization.ReportXmlSerializer.Deserialize(Stream stream)

 

Is this error related to the Trial version or is there anything else?

Dimitar
Telerik team
 answered on 20 Feb 2024
1 answer
122 views

ReportXmlSerializer().Serialize() throws unexpected System.ArgumentException:
'Invalid name character in 'MyData[]'. The '[' character, hexadecimal value 0x5B, cannot be included in a name.'

How can I prevent this?
- Or -
What other way can I save the data with the report?
private void CreateReport() {
    var report = new Telerik.Reporting.Report();
    report.Name = "MyReport";
    var detail = new Telerik.Reporting.DetailSection();
    report.Items.Add(detail);
    var textBox = new Telerik.Reporting.TextBox();
    textBox.Value = "Hello World!";
    detail.Items.Add(textBox);

    var dataSource = new ObjectDataSource();
    dataSource.Name = "MyData";
    dataSource.DataSource = MyData.Sample;

    report.DataSource = dataSource;

    var reportPath = @"C:\develop\Temp\MyReport.trdp";
    new ReportXmlSerializer().Serialize(reportPath, report);
}

public class MyData {
    public static readonly MyData[] Sample = { new() { Text = "Foo", Number = 42 }, new() { Text = "Bar", Number = 21 } };

    public string Text { get; set; }
    public int Number { get; set; }
}

Dimitar
Telerik team
 answered on 19 Apr 2023
0 answers
142 views

I'm using a HTML5 Web Forms Report Viewer

Here is my code:

            var reportPackager = new ReportPackager();

            var reportInstance = new Report();

            using (var sourceStream = System.IO.File.OpenRead("PathToTRDPFile"))

            {

                reportInstance = (Report)reportPackager.UnpackageDocument(sourceStream);

            }

            var table3 = reportInstance.Items.Find("table3", true)[0] as Telerik.Reporting.Table;

            table3.DataSource = CreateDataTable(); //A function that returns a datatable

            var instanceReportSource = new InstanceReportSource { ReportDocument = reportInstance };

            this.reportViewer1.ReportSource = instanceReportSource;

The error that I got: 

Error CS0029 Cannot implicitly convert type 'Telerik.Reporting.InstanceReportSource' to 'Telerik.ReportViewer.Html5.WebForms.ReportSource'

Any idea on how to resolve this?

1 answer
213 views

When I start the telerik report designer I get this error message:

Clicking ok opens the designer but in the main screen I see:

Telerik.Reporting.Xml.XmlSerializerExcepion: An error has occurred during xml serialization. The xml serializer cannot resolve type with name: Report
   at Telerik.Reporting.Xml.ObjectXmlReader.ReadXmlElement(String name)
   at Telerik.Reporting.Xml.ObjectXmlReader.Deserialize()
   at Telerik.ReportDesigner.Packages.ReportDesigner.Serialization.ReportDesignerLoader.ReadReport()
   at Telerik.ReportDesigner.Packages.ReportDesigner.Serialization.ReportDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)

I don't think this error is related with a particular report because it shows every time I open the software.

I used the designer just few days ago and worked perfectly, what can I do? Thanks

 

Plamen Mitrev
Telerik team
 answered on 09 Jul 2021
4 answers
459 views

Hi

I'm developing an WPF app that imports trdx file, serializes to a report object, set an ObjectDataSource and generate (using RenderReport method) to pptx file.

The trdx file contains a subreport with the same DataSource but different DataMember. The DataMember of the subreport get an input from the a report parameter (=Parameters.Param1.Value). The subreport parameter filled by the main report (Param1 =Fields.Id).

For example, for each order in the report, the subreport get its ID as parameter and returns all its order details.

In the generated report (pptx) I see all the reports data but the subreport data is empty. How should I set the DataSource, DataMember and Paramerters of the subreport correctly?

 

Thanks

Michal

 

1 answer
79 views

Has anyone figured out how to provide an incremental build version of a report (report definition file) that can be read by the web app? I would like to display this version for tech support so they can see if the client has the latest version of that particular report.

I'm NOT talking about the Telerik version the report was created in. I'm talking about versioning the report itself

Todor
Telerik team
 answered on 12 May 2021
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?