Report Designer Preview is not working when using ObjectDataSource inside Visual Studio.
|Product||Progress® Telerik® Reporting|
|Report Designer||Visual Studio Designer|
As the Visual Studio Report Designer operates inside Visual Studio, when previewing a report there, the report constructor is executed in the context of the Visual Studio application and all the configuration settings are obtained from the Visual Studio's devenv.exe.config file.. If not taken upon consideration, this might lead to two major issues - ConnectionStrings and AssemblyReferences mismatch.
Make sure the following are correctly set up:
As described in MSDN, the ConfigurationManager.ConnectionStrings property gets the ConnectionStringsSection data for the current application's default configuration.
In case of Visual Studio, this is devenv.exe.config. The SqlDataSource component is particularly designed to use the current's project configuration file. However, if your custom Data Access Layer (DAL) is reading the ConfigurationManager.ConnectionStrings from the report that is previewed you get all connection strings defined in the devenv.exe.config file. In order to avoid the error you have several options:
- Hard code the ConnectionString in your Data Access Layer(DAL);
- Use a desktop application with a report viewer(WinForms/WPF) to view your reports in runtime instead of the VS Previews;
- Add the required ConnectionString in devenv.exe.config;
- Use the SqlDataSource component instead of the ObjectDataSource component. The SqlDataSource component will resolve the ConnectionStrings in the reports projects.
For VS 2017 and higher, the devenv.exe.config's default location is C:\Program Files (x86)\Microsoft Visual Studio*year*\Professional|Community\Common7\IDE.
The AssemblyReferences section contains assembly descriptions that are used to resolve the necessary assemblies during design and/or processing stage. When designing a report that uses ObjectDataSource in Visual Studio Designer, the engine will add the necessary AssemblyReferences entries in the configuration file of the current project. However, when you preview the report in a standalone application, you need to add these entries in the application configuration file so the processing engine would be able to resolve the necessary types.
To debug the data access layer while using the Visual Studio Report Designer, you may do the following:
- Open another Visual Studio instance
- Select Debug->Attach to process to debug another instance of devenv.exe
- Select Debug->Exception... to enable the First Chance Exceptions. ## See Also