| Author |
Message |
smuda
Joined: 08 Jan 2012 Posts: 18 Location: Sweden
|
Posted: Sun Jan 08, 2012 3:39 pm Post subject: Can't get feature reporting to work on console app |
|
|
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 |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6348 Location: Red Gate Software
|
Posted: Mon Jan 09, 2012 4:46 pm Post subject: |
|
|
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. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6348 Location: Red Gate Software
|
Posted: Mon Jan 09, 2012 4:53 pm Post subject: |
|
|
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. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
smuda
Joined: 08 Jan 2012 Posts: 18 Location: Sweden
|
Posted: Mon Jan 09, 2012 9:35 pm Post subject: |
|
|
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 |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6348 Location: Red Gate Software
|
Posted: Tue Jan 10, 2012 11:50 am Post subject: |
|
|
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. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6348 Location: Red Gate Software
|
Posted: Tue Jan 10, 2012 12:17 pm Post subject: |
|
|
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. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
smuda
Joined: 08 Jan 2012 Posts: 18 Location: Sweden
|
Posted: Tue Jan 10, 2012 9:50 pm Post subject: |
|
|
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 |
|
 |
smuda
Joined: 08 Jan 2012 Posts: 18 Location: Sweden
|
Posted: Wed Jan 11, 2012 5:11 am Post subject: |
|
|
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.
Perhaps there could be a checkbox to NOT make the thread a background thread in the saproj settings would be a good thing?
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 |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6348 Location: Red Gate Software
|
Posted: Wed Jan 11, 2012 1:25 pm Post subject: |
|
|
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. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
|