Can't get feature reporting to work on console app

.NET obfuscator and automated error reporting

Moderators: Luke Jefferson, melvyn.harbour, dom.smith

Can't get feature reporting to work on console app

Postby smuda » Sun Jan 08, 2012 3:39 pm

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
smuda
 
Posts: 18
Joined: Sun Jan 08, 2012 3:12 pm
Location: Sweden

Postby Brian Donahue » Mon Jan 09, 2012 4:46 pm

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
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Postby Brian Donahue » Mon Jan 09, 2012 4:53 pm

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
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Postby smuda » Mon Jan 09, 2012 9:35 pm

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: Select all
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
smuda
 
Posts: 18
Joined: Sun Jan 08, 2012 3:12 pm
Location: Sweden

Postby Brian Donahue » Tue Jan 10, 2012 11:50 am

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/C ... _using_fur

According to this you don't have to do anything to the entry point.
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Postby Brian Donahue » Tue Jan 10, 2012 12:17 pm

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
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Postby smuda » Tue Jan 10, 2012 9:50 pm

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
smuda
 
Posts: 18
Joined: Sun Jan 08, 2012 3:12 pm
Location: Sweden

Postby smuda » Wed Jan 11, 2012 5:11 am

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
smuda
 
Posts: 18
Joined: Sun Jan 08, 2012 3:12 pm
Location: Sweden

Postby Brian Donahue » Wed Jan 11, 2012 1:25 pm

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
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am


Return to SmartAssembly 6

Who is online

Users browsing this forum: No registered users and 1 guest

cron