[SalesForce] Not able to make Lightning Component work outside Managed Package Dev Org

When I package my app in Managed Package for outside world, the other org gets "Internal Server Error" when the Lightning Component Tab is loaded in S1 or new Lightning Experience interface.

I worked out myself to see if I missed namespaces. While doing that I'm trying to work namespaces according to this document –
Lightning Component Usage in Organizations with a Namespace Prefix

Now I'm having big trouble in getting my code to save with things mentioned in the document.

For example:

1] The document suggests this format for initiating sObject and default:

<aura:attribute name="newExpense" type="myns.Expense__c"
    default="{ 'sobjectType': 'myns__Expense__c',
               'Name': '',
               'myns__Amount__c': 0
    }" />

I save my code just like the way mentioned above. But it auto changes back to this format:

<aura:attribute name="newExpense" type="myns__Expense__c"
    default="{ 'sobjectType': 'myns__Expense__c',
               'Name': '',
               'myns__Amount__c': 0
    }" />

Please note that the attribute type auto changed from type="myns.Expense__c" to type="myns__Expense__c" and I've no understanding if this could cause the Internal Server Error and if so, how can I make this fix? Because I try to change CORRECT format of code but Developer Console changes it back to incorrect format.

2] Secondly, the same kind of issue in attribute noticed in another place:
I am trying to save this attribute like this:

<aura:attribute name="matches" type="myns.wDataItem[]" description="The data items returned by the Apex controller." />

but it auto changes back to this:

<aura:attribute name="matches" type="myns.wDataItem" description="The data items returned by the Apex controller." />

Noticed the changes of Type attribute again? It changed from type="myns.wDataItem[]" to type="myns.wDataItem". I want a Custom Apex class array datatype. The APEX Class is Public and all Properties are marked with @AuraEnabled.

But if I change the attribute to this:

<aura:attribute name="matches" type="c.wDataItem[]" description="The data items returned by the Apex controller." />

It save correctly with Datatype being an Array instead of single item. Here I used the default namespace c this making type="c.wDataItem[]"

And with these namespace or default namespace, the Lightning Component Tab works absolutely fine in the Dev Org environment.

And from SFDC Support I was able to get more details about Internal Server Error, they say the error is this:

404 Not Found (Application Error)
Cause: InvalidExpressionException: Unable to read SObject

So it seems the sObject is not readable due to namespacing issue and if I am not able to save the correct code from Developer Console, how can I make sure I get this error resolved? I'm really stuck bad here, need help!

Best Answer

After Spring '16 deployment the same component started working fine.

SFDC support was also not able to pin point the cause. They were able to reproduce it but have not suggested it as a bug (strange!).

Though Spring '16 deployment have magically fixed that. I'm now able to run my same old code without any modifications and no errors of internal server on tab load in managed packaged lightning component.

It seems I was in fact doing all things right.