I have the following VB.Net class library as a dll, containing the function with a given namespace:
Imports Telerik.Reporting.Expressions
Public Class ReportExtensions
<[Function](Category:="Report Extended Functions", [Namespace]:="ReportExtensions", Description:="Returns a string that was given to the function")>
Public Function TestFunc(str As String) As String
Return str
End Function
End Class
Here is the location of the dll:
And my config file:
<?xml version ="1.0"?>
<configuration>
<configSections>
<section
name="Telerik.Reporting"
type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting, Version=15.1.21.616, Culture=en-AU, PublicKeyToken=a9d7983dfcc261be"
allowLocation="true"
allowDefinition="Everywhere"/>
<section
name="Telerik.ReportDesigner"
type="Telerik.ReportDesigner.Configuration.ReportDesignerConfigurationSection, Telerik.ReportDesigner.Configuration"
allowLocation="true"
allowDefinition="Everywhere"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!--
<probing privatePath="path-to-the-assemblies"/>
-->
<dependentAssembly>
<!-- Required for interoperability with older versions of Telerik Reporting -->
<assemblyIdentity name="Telerik.Reporting" culture="neutral" publicKeyToken="a9d7983dfcc261be"/>
<bindingRedirect oldVersion="0.0.0.0-15.1.21.616" newVersion="15.1.21.616"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<Telerik.ReportDesigner DefaultWorkingDir="Examples">
</Telerik.ReportDesigner>
<!-- Add assembly references -->
<Telerik.Reporting>
<AssemblyReferences>
<add name="ReportDesignerExtensions" version="1.0.0.0" culture="en-AU" publicKeyToken="null" />
</AssemblyReferences>
</Telerik.Reporting>
</configuration>
Here is a simple expression on a textbox on the Standalone Report Designer (also I cannot physically find my function declared in the editor window, I just have to type in the exact name):
The function should simply return "asd", but for some reason I see nothing when previewing the report. The textbox below works as expected.
What am I missing?
I've followed steps from Issue with User defined function in ReportViewer in Reporting | Telerik Forums and Preview report definition, which uses an external assembly with user-defined functions or CLR objects | Telerik Reporting, to no avail.
Hi Chris,
The configuration seems correct to me. What's the framework and the version of the Class Library? Note that the Standalone Report Designer is a WPF application built against .NET Framework 4.0. For that reason, it cannot load and resolve classes from assemblies built against .NET Standard 2.1, .NET Core, .NET5 and .NET6. You can see the .NET Standard compatibility chart which explains how and when the assemblies can be loaded in different framework versions.