Red Gate forums :: View topic - Can't get feature reporting to work on console app
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 6
SmartAssembly 6 forum

Can't get feature reporting to work on console app

Search in SmartAssembly 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
smuda



Joined: 08 Jan 2012
Posts: 18
Location: Sweden

PostPosted: Sun Jan 08, 2012 3:39 pm    Post subject: Can't get feature reporting to work on console app Reply with quote

Hi All!

I have three apps (1 winform and 2 console apps) that I'm trying to enable feature usage reporting on.

All is well on the winform and one console app, but the last console app doesn't show the "Would you like to send feedback..." question. The one thing that puzzles me is that at first run the console application automatically adds a registry entry "SmartAssemblyReportUsage" with the value of "False". If I change the value to "True", feature reports are generated.

What have I missed to get the "Would you like to send feedback..." question?

I have verified in the project that FeatureUsage Reporting is enabled with the standard template provided by SmartAssembly "With consent dialog box on first run".

From the saproj file:
<FeatureUsageReporting ReportUsages="1" Template="res:SmartUsageWithUIConsentFirstRun1033.dll" />

Best Regards,

John
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6577

PostPosted: Mon Jan 09, 2012 4:46 pm    Post subject: Reply with quote

Hi John,

Sorry, I don't know what could be wrong. The "first run" dialog should come up and set the registry key according to the user's wishes.

The "standard template" should be embedded into your assembly so if it's not coming up I probably couldn't tell you why not without seeing the assembly.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6577

PostPosted: Mon Jan 09, 2012 4:53 pm    Post subject: Reply with quote

Based on one of your other posts, I have to ask, are you trying to put the feature usage reporting in a DLL? Because as I recall it has to go on the main assembly if you want the "first use" dialog to come up.
Back to top
View user's profile Send private message
smuda



Joined: 08 Jan 2012
Posts: 18
Location: Sweden

PostPosted: Mon Jan 09, 2012 9:35 pm    Post subject: Reply with quote

Hi Brian!

Yes, I'm trying to handle feature usage in the common dlls for the three projects. However, since I read somewhere that to get the feature usage template working I need to set the ReportUsage on the entry method, which I've done for both the console apps:

Code:

internal class Program
{
   [ReportUsage("ApduScriptPlayer")]
   [STAThread]
   private static void Main(string[] args)
   {

I'd be happy do upload the obfuscated assembly, project file or even the input assemblies to you, if you think it can help.

John
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6577

PostPosted: Tue Jan 10, 2012 11:50 am    Post subject: Reply with quote

You only have to put the attribute on the methods you want to report on and then reportusage in the places where you want the feature usage reported. Please see: http://www.red-gate.com/supportcenter/Content/SmartAssembly/help/6.5/sa_using_fur

According to this you don't have to do anything to the entry point.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6577

PostPosted: Tue Jan 10, 2012 12:17 pm    Post subject: Reply with quote

I just went through the SmartAssembly source code to confirm this -- Feature Usage asks the user whether or not he wants to send reports the first time feature usage is gathered from the program. So unlike Error Reporting, it should work on the dll without having to do anything to the main assembly.

As far as I can work out from the source (and maybe this is a bad assumption), you should be able to get the user request box back up if the SmartAssemblyReportUsage registry key does not exist or has no value.
Back to top
View user's profile Send private message
smuda



Joined: 08 Jan 2012
Posts: 18
Location: Sweden

PostPosted: Tue Jan 10, 2012 9:50 pm    Post subject: Reply with quote

Yes, removing the SmartAssemblyReportUsage registry entry on the other two assemblies makes the dialog re-appear, but not this one.

Is there any logging that can be enabled for the feature usage within the merged assembly?

I suppose the default template is the one included in SA. If you look on line 21 it sets the registry value to false and AskUserForReportUsageConfirm(). If something happens there it will have the exact same behavior that I'm experiencing. I think I'll try with a custom template (based on this) with more error handling.

Best Regards,

John
Back to top
View user's profile Send private message
smuda



Joined: 08 Jan 2012
Posts: 18
Location: Sweden

PostPosted: Wed Jan 11, 2012 5:11 am    Post subject: Reply with quote

By adding message boxes in the UsageReporterWithUI sample I realized that the thread used for displaying the dialog for user permission is run on a background thread.

This means that when the console app is done on it's thread, all background threads are simply dismissed.

I added a Thread.Sleep in the console application and the dialog for the user pops up nicely. I can wait and then see it disappear once the application ends.

Idea Perhaps there could be a checkbox to NOT make the thread a background thread in the saproj settings would be a good thing?

Idea I note that once the reporting is added, the application takes another half second (roughly) to end and I suppose this is because of the actual reporting. During that time, you could also check if the reporting thread you spawned which is waiting for the user input has ended. Perhaps a Thread.Join would be a good thing at that point?

Best Regards,

John
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6577

PostPosted: Wed Jan 11, 2012 1:25 pm    Post subject: Reply with quote

Hi John,

I'm told the idea is not to leave a console process hanging,waiting for input, if the dialog comes up. Apparently we are already looking at alternate ways of "opting in" on console applications.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group