This is a migrated thread and some comments may be shown as answers.

Preview using cached assemblies

2 Answers 103 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
TonyG
Top achievements
Rank 1
TonyG asked on 30 Mar 2013, 10:11 PM
I have an assembly that provides data to a report.
I have a project with a report that references the assembly.
In the report I set the NeedsDataSource handler to call my assembly to provide the data.

I found that making a change and rebuilding the data assembly does not result in report changes. I was confounded by this because I have a logging mechanism which consistently showed an old version of my code being executed by the Preview functionality. Changes are reflected from the designer. My assembly is called and the log shows the latest version being executed Designer. But Preview always executed the old code.

I did a Clean, then Rebuild. I changed every component to ensure something different was in the object module. I manually deleted the .DLL and .PDB files from the project directories, completely deleted everything under \obj. The rebuild put new files in their place, but Preview always showed the original log data. I closed the solution and re-opened. That didn't help. I changed the assembly reference to Copy Local = False. No joy.

I got another tip that an old assembly was being cached somewhere, because I changed my class.getdata() call in NeedsDataSource to class.getDataNew() and changed the corresponding method in the data assembly. Everything compiled, Intellisense showed it could find the changed method name. But in Preview it said it can't find class.getdata(). Obviously it was holding onto something and not using the code in my report class.

I found that when I completely closed down Visual Studio (2010) and re-opened the report project, that the latest data assembly was being referenced. This confirms there's some caching going on. This could be because the original assembly is reflected-upon and thus stored somewhere, and from then forward it's That assembly which is used rather than the referenced assembly.

It looks like the cache is here:
C:\Users\{user}\AppData\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies

You can't delete the directories in there when VS is running. On build (and use by the Designer) a single directory is created for each project (or each assembly in the project). On rebuild after access from the Designer, another directory is created for rebuilt assemblies. The original assembly is still there and can't be deleted. THAT is what's being referenced.

With the above info I did a search in the forum for ProjectAssemblies and found this thread:
http://www.telerik.com/community/forums/reporting/telerik-reporting/degign-view-error.aspx
So I copied my assembly to C:\Program Files\Telerik\Reporting Q1 2013\Bin, reset the reference there, and saw that version. Rebuilt my assembly, copied it to that location, closed and restarted the designer to get it to refresh. The Designer sees the new assembly, the Preview does not.

I can get by this by constantly restarting Visual Studio, but oh what a pain! Any other remedies?

Thanks!

2 Answers, 1 is accepted

Sort by
0
TonyG
Top achievements
Rank 1
answered on 30 Mar 2013, 10:58 PM
As usually happens after a thorough description of an involved problem, I may have an acceptable solution for now.

Since the report is attempting to read an assembly with a specific version (1.0.0.0 by default), I just set the data assembly to generate a new version on every build (1.0.*.). Close the Designer for the report and remove the referenced data assembly. Rebuild the data assembly. Re-reference the new assembly. Then re-open the Designer. This uses the new assembly. Preview now also uses the updated data assembly.

It would be nice if Telerik could work out a way to help us avoid this shuffle.

Thanks again.
0
Elian
Telerik team
answered on 03 Apr 2013, 01:10 PM
Hello Tony,

As you have noticed the Visual Studio is caching the assemblies and basically this is out of our reach. In the particular scenario we would suggest instead of using the built-in preview to create a light-weight application (for e.g. WinForms) with a Report Viewer that you can quickly run and preview the report changes. 
 

Regards,
Elian
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

Tags
General Discussions
Asked by
TonyG
Top achievements
Rank 1
Answers by
TonyG
Top achievements
Rank 1
Elian
Telerik team
Share this question
or