Bug 34960 - Natvie Cross-Platform Templates Incorrectly Creates/Setups Insights NuGets/Init/Backend
Summary: Natvie Cross-Platform Templates Incorrectly Creates/Setups Insights NuGets/In...
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Insights Add-in ()
Version: 5.10 (C6SR3)
Hardware: Macintosh Mac OS
: High normal
Target Milestone: 5.10 (C6)
Assignee: Greg Munn
URL:
Depends on:
Blocks:
 
Reported: 2015-10-16 14:04 UTC by James Montemagno [MSFT]
Modified: 2015-10-27 08:44 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description James Montemagno [MSFT] 2015-10-16 14:04:56 UTC
# Steps to reproduce
1.) File -> New Solution 
2.) Cross-Platform -> App -> Native -> Single View App
3.) Name App (My Test App)
4.) Use Portable Class Library
5.) Enable Insights
6.) Finish App

Android project is configured correctly with Xamarin Insights NuGet Package and Init inside of MainActivity.cs (however, it would be better inside of a subclassed Application IMHO).

Android project is configured correctly on http://insights.xamarin.com, but with a weird name of "MyTestApp.Droid", 

iOS project is not calling the Init at all in app delegate.

# Expected behavior
1.) Android application named such as: "My Test App Android"
2.) iOS application named such as: "My Test App iOS"
3.) iOS Application has Init Called in App Delegate
4.) Insights NuGet installed in PCL project

# Actual behavior
1.) Named "MyTestApp.Droid"
2.) Named "My Test App"
3.) Not called at all anywhere 
4.) Not installed

# Supplemental info (logs, images, videos)

# Test environment (full version information)
		=== Xamarin Studio ===

Version 5.10 (build 811)
Installation UUID: f081c568-2d88-4695-ac20-73049973693d
Runtime:
	Mono 4.2.1 (explicit/804ddbc)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010060

=== Xamarin.Profiler ===

Version: 0.0.0.0
Location: /Applications/profiler-mac-0.9-29/XamarinProfiler.Mac.app/Contents/MacOS/XamarinProfiler.Mac

=== Apple Developer Tools ===

Xcode 7.0.1 (8228)
Build 7A1001

=== Xamarin.iOS ===

Version: 9.2.0.84 (Business Edition)
Hash: b5396c2
Branch: master
Build date: 2015-09-30 15:22:15-0400

=== Xamarin.Android ===

Version: 6.0.0.8 (Business Edition)
Android SDK: /Users/jamesmontemagno/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.3   (API level 18)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 24.4
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.2
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.4.0.79 (Business Edition)

=== Build Information ===

Release ID: 510000811
Git revision: 34cd31ea72536afab530c14d9220b286075e83cd
Build date: 2015-09-30 10:40:37-04
Xamarin addins: 8e6fccfc0c19a7e0b7b11be925f09751d827eb5c
Build lane: monodevelop-lion-cycle6

=== Operating System ===

Mac OS X 10.10.5
Darwin Jamess-MacBook-Pro-2.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 1 Sadik Ali 2015-10-19 10:19:06 UTC
I have checked this issue and able to reproduce the above behavior with the help of steps given in the bug description.

1. Named "MyFirstApp.Droid"
2. Named "MyFirstApp"
3. Init not Called in App Delegate but its available in Main.cs
4. Not Installed

Screencast: http://www.screencast.com/t/Eg760jbrZTG3
Ide Logs: https://gist.github.com/Rajneesh360Logica/619b4ed11c5c62e93cee

Environment Info:
=== Xamarin Studio ===

Version 5.10 (build 842)
Installation UUID: 2591d519-875d-4afe-a3d9-5fcf391bbd2d
Runtime:
	Mono 4.2.1 (explicit/b50293b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010075

=== Xamarin.Profiler ===

Version: 0.19.26.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 7.0 (8227)
Build 7A220

=== Xamarin.iOS ===

Version: 9.2.0.93 (Starter Edition)
Hash: 1a6b88f
Branch: master
Build date: 2015-10-14 16:16:18-0400

=== Xamarin.Android ===

Version: 6.0.0.17 (Trial Edition)
Android SDK: /Users/nischal/Desktop/sdkndk/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 24.4
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.1
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.4.0.82 (Starter Edition)

=== Build Information ===

Release ID: 510000842
Git revision: e0ba443b30dde7b6187407f827c032536ed66df8
Build date: 2015-10-16 10:39:01-04
Xamarin addins: 11107ae82ba397e7eb3e2c9df4792e7e78c54c5d
Build lane: monodevelop-lion-cycle6

=== Operating System ===

Mac OS X 10.10.4
Darwin nischals-Mac-mini.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 3 Greg Munn 2015-10-19 12:43:16 UTC
@James - for reference
https://docs.google.com/document/d/1VrsFYiaq8x2NfDgLsW5lkoHUnOyF79P8B4hmvXGgkPE/edit#heading=h.ofuzfjo3eu94

- Android adds init calls to application subclass **if** one is defined, otherwise Activity subclass.
- iOS adds init calls to Main.cs
- I'm not aware of the insights nuget supporting PCL projects
- there does appear to be an issue with the name of the android project - it should be the same as the iOS project
Comment 4 Greg Munn 2015-10-19 13:18:46 UTC
I have fixed the issue with the name of the android app. I don't see any specific issue with the other points made.
Comment 5 James Montemagno [MSFT] 2015-10-19 13:28:41 UTC
1.) Sounds perfect
2.) I did not see it add it into the Main.cs file when I created this new project
3.) This is the main use case to call insights from the PCL, it should be added there as well. The design doc should be updated as that is where a lot of the exceptions and reporting would be done
4.) Sounds good :), but shoudl it be the same? I think if you are creating both an iOS and Android app then it should append iOS or Android at the end. Else, you are going to have two apps of the same name, but different platforms, which is very confusing.
Comment 6 Greg Munn 2015-10-19 13:49:41 UTC
2. Can you double check? I see you logged another issue with respect to code init in main.cs

3. This was unspecified, we should split that out to a different bug / enh

4. The names should be the same, that way Insights can report audience across platforms

"The app name (as specified in the protect wizard) is used as the name for the new Insights application. If the user already has an application with that name, the IDE will use the API key for that application"
Comment 7 James Montemagno [MSFT] 2015-10-19 14:02:12 UTC
2.) Just validated and is now in main.cs
3.) Sounds good and agreed seems like a design oversight. Would not be blocking at all.
4.) Hmmm interesting... is it generating 1 new app or 2 new apps in the insights backend.. ie, are both iOS/Android using the same API Key (this is what I prefer).
Comment 8 Greg Munn 2015-10-19 14:05:19 UTC
4. You get the same api key for both platforms
Comment 9 James Montemagno [MSFT] 2015-10-19 14:06:29 UTC
Ahhhh I see now, yes this makes sense. Since the names were different before then it was generating 2 keys.

Lovely, so the issue here that I believe you have fixed is that one of the app names was not setup correctly in the backend causing 2 api keys to be generated.
Comment 10 Greg Munn 2015-10-19 14:10:04 UTC
Correct.
Comment 11 xamarin-release-manager 2015-10-20 03:14:39 UTC
Fixed in version 5.11.0.322 (master)

Author: Greg Munn
Commit: 3205e66c09b9a11ea8185e4ba775f44046d4504c (xamarin/md-addins)
Included in Commit: 964faf1f63b50a425cdf1670c9abebe7d5e32b5b (mono/monodevelop)
Comment 12 asimk 2015-10-20 14:41:19 UTC
I have checked this issue with latest Cycle6 builds and still getting same issue. Here is the screencast for the same: http://www.screencast.com/t/FmpbQky9y9w

Ide Log: https://gist.github.com/Asimk360/079a6f23945808a21b77

Environment Info:
=== Xamarin Studio ===

Version 5.10 (build 843)
Installation UUID: 449f40dd-b3f1-4028-9a6b-cca0d1a2307d
Runtime:
	Mono 4.2.1 (explicit/66852f8)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010078

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.0 (8227)
Build 7A220

=== Xamarin.iOS ===

Version: 9.2.0.93 (Enterprise Edition)
Hash: 1a6b88f
Branch: master
Build date: 2015-10-14 16:16:18-0400

=== Xamarin.Android ===

Version: 6.0.0.18 (Enterprise Edition)
Android SDK: /Users/360logicaxamarinmacmini/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.2    (API level 17)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)

SDK Tools Version: 24.3.4
SDK Platform Tools Version: 23
SDK Build Tools Version: 21.1.2

Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.2
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.4.0.88 (Enterprise Edition)

=== Build Information ===

Release ID: 510000843
Git revision: efc4de95f8236389b2119112c095a93ea759c358
Build date: 2015-10-19 14:50:32-04
Xamarin addins: d06b3a6b906b637ac0442f0e9f362b8b91706b50
Build lane: monodevelop-lion-cycle6-bug-34960

=== Operating System ===

Mac OS X 10.10.5
Darwin 360LogicasMacmini.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 13 Greg Munn 2015-10-20 14:53:21 UTC
@asimk wrong bug!

you mean this one #33361, the one you reopened previously
Comment 14 Greg Munn 2015-10-20 15:50:29 UTC
@asimk, can you try again with the latest build (5.11.0.330) from master.

It will likely fail, but I log the json out to the ide.log so we can see what is being returned from Insights. I'm certain that whatever is being returned is invalid - in which case, what you are seeing is correct - it should fail. 

The question is, why is it failing for you?
Comment 15 asimk 2015-10-23 14:06:15 UTC
I have checked this issue with latest Master build i.e. XamarinStudio-5.11.0.351_cc7a473f0d7004d71f1407790a1d1f9d77ba0fb5
and observed that I am getting same Insight API key for both Android and iOS project.
Also I am getting Xamarin.Insights package for both android and iOS project.
Screencast: http://www.screencast.com/t/bZaGUcIStnC

Please let me know if I can check any thing else to verify this issue.

Environment Info:
=== Xamarin Studio ===

Version 5.11 (build 351)
Installation UUID: 449f40dd-b3f1-4028-9a6b-cca0d1a2307d
Runtime:
	Mono 4.0.5 ((detached/1d8d582)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400050001

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.1 (9079)
Build 7B91b

=== Xamarin.iOS ===

Version: 9.1.0.18 (Trial Edition)
Hash: 7426bd7
Branch: master
Build date: 2015-10-21 22:54:37-0400

=== Xamarin.Android ===

Version: 5.1.9.0 (Trial Edition)
Android SDK: /Users/360logicaxamarinmacmini/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.2    (API level 17)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)

SDK Tools Version: 24.3.4
SDK Platform Tools Version: 23
SDK Build Tools Version: 21.1.2

Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.2
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.4.0.79 (Trial Edition)

=== Build Information ===

Release ID: 511000351
Git revision: cc7a473f0d7004d71f1407790a1d1f9d77ba0fb5
Build date: 2015-10-23 12:14:58-04
Xamarin addins: 1c5ec239311635ba87969b5392291599eeca6479
Build lane: monodevelop-lion-master

=== Operating System ===

Mac OS X 10.10.5
Darwin 360LogicasMacmini.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

D Language Binding 2.13.4
D Language Debugging Support under GNU/Linux (GDB) 1.2.10
Comment 16 xamarin-release-manager 2015-10-26 11:27:09 UTC
Fixed in version 5.10.0.852 (cycle6)

Author: Greg Munn
Commit: d06b3a6b906b637ac0442f0e9f362b8b91706b50 (xamarin/md-addins)
Included in Commit: 3bccaa56268f0f1e3dc4b458840cca0ac31f03c6 (mono/monodevelop)
Comment 17 Sadik Ali 2015-10-27 08:44:14 UTC
I have checked this issue with latest Cycle 6 build i.e
XamarinStudio-5.10.0.857_b75629ca44ff4591ea001061f8e0cf2e33380f67 and getting same Insight API key for both Android and iOS project.

Screencast: http://www.screencast.com/t/SIGiigQ6x3

Hence I am closing this issue.