locked
JavaScript Metro App - Intellisen Error Listing WinRT Component stuff

    Question

  • Hi guys

    I'm having problem listing WinRT Component namespace/property/methods in JS Metro Apps.
    I found a related output info like below which might hint the root cause:
    11:29:20.5662: An error occurred while creating a reference source file from the project references in project ...\WinWebApp1.wwaproj'.
    11:29:20.5662: JSGen.exe was successfully launched, but failed to update its output file.
    11:29:20.5662: IntelliSense may be incorrect as a result.  To try the generation again, close and reopen the project.

    Anybody who met with this issue before? You're so kind to offer any indication, :)

    Thursday, March 1, 2012 3:36 AM

Answers

  • In order to drill into this further we'll need to see the WinRT component public API that you're trying to expose.  The declarations should be sufficient (no implementation necessary).  If you're uncomfortable sharing that on the forum, feel free to email the information to ansonh@microsoft.com and we can take a look.  It would also be interesting to know if the file named 'references.js' in %temp%\<projectname>_RefCache contains any content or not.  If it does, please include that in the mail as well.  Finally, it would be great if you could share the JavaScript consumption code where you're expecting to see IntelliSense but it's not showing up. 

    Appreciate it!
    Anson Horton [MSFT]


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by wqter Monday, April 9, 2012 3:16 AM
    Wednesday, March 7, 2012 12:44 AM

All replies

  • What is the error since above description just from the output, and what is the code in JS to use the WinRT? Did you test it in VS11 beta? Thanks.

    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, March 1, 2012 10:25 AM
  • This sounds like you are having difficulty in Visual Studio, is that the case?  What version are you using and what platform are you running on?

    Jeff Sanders (MSFT)

    Thursday, March 1, 2012 1:43 PM
    Moderator
  • The JavaScript language service uses a tool called JSGen in order to create a JavaScript 'facade' of the WinRT component that you're trying to consume.  This error usually indicates JSGen didn't recognize some part of the metadata it was processing when creating this facade.  We'll need more information to figure out the exact problem, though one thing certainly jumps out.  With the release of Visual Studio Beta the .wwaproj is no longer supported and has changed to .jsproj.  Are you using the developer preview?  If so, I would suggest upgrading to Visual Studio Beta and the Windows 8 Consumer Preview when you get the chance.  If you still encounter this with the Beta release, then it would be helpful to see the WinRT component that you're developing (the public signatures should be enough). 

    Hope that helps!

    Anson Horton [MSFT]


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Saturday, March 3, 2012 8:57 PM
  • The error message provided below is generated on Win8 DP :). I'm currently using Win8 Customer Preview(8250) and VS11 Beta.
    But the problem remains:
    Sometimes I could not list the activatable classes defined in my WinRT Component Dll.
    When I started with a simplest WinRT comp + JS Metro App, I could clearly view the exposed classes / and their methods in JS.
    But after appending more classes, the Intellisense seemed ceases working... the list box became filled with yellow triangles with a ! in it....

    Monday, March 5, 2012 7:52 AM
  • thanks plz see my reply below :)
    Monday, March 5, 2012 7:53 AM
  • thanks plz see my reply below :)
    Monday, March 5, 2012 7:53 AM
  • In order to drill into this further we'll need to see the WinRT component public API that you're trying to expose.  The declarations should be sufficient (no implementation necessary).  If you're uncomfortable sharing that on the forum, feel free to email the information to ansonh@microsoft.com and we can take a look.  It would also be interesting to know if the file named 'references.js' in %temp%\<projectname>_RefCache contains any content or not.  If it does, please include that in the mail as well.  Finally, it would be great if you could share the JavaScript consumption code where you're expecting to see IntelliSense but it's not showing up. 

    Appreciate it!
    Anson Horton [MSFT]


    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by wqter Monday, April 9, 2012 3:16 AM
    Wednesday, March 7, 2012 12:44 AM
  • Hi there Horton, thanks for your hint, i found if there's a overrided method in activatable class, the references.js file could not be generated. That should be the cause of my concerned issue.

    The code below can reproduce the issue metioned...

    #pragma once
    
    using namespace Platform;
    
    namespace WinRTComponentDll
    {
    	// Region base
    	public ref class Region
    	{
    	protected:
    		int _type;
    	public:
    		property int Type
    		{
    			int get() { return _type; }
    			void set(int type) { _type = type; }
    		}
    
                    virtual void foo(){}
    	};
    
    	// Simple Point
    	public ref class Point sealed
    	{
    		float _x, _y;
    	public:
    		Point(float x, float y): _x(x), _y(y){}
    
    		property float X
    		{
    			float get() { return _x; }
    			void set(float x) { _x = x; }
    		}
    		property float Y
    		{
    			float get() { return _y; }
    			void set(float y) { _y = y; }
    		}
    
    	};
    
    	// Circle Region
    	public ref class Circle sealed : public Region
    	{
    		Point^ _center;
    		int _radius;
    	public:
    		Circle(Point^ p, int radius)
    		{
    			Center = p;
    			Radius = radius;
    		}
    		property Point^ Center
    		{
    			Point^ get() { return _center; }
    			void set(Point^ p) { _center = p; }
    		}
    
    		property int Radius
    		{
    			int get() { return _radius; }
    			void set(int r) { _radius = r; }
    		}
    
                    virtual void foo() override {} // !!!
    	};
    
    }

    Thursday, March 8, 2012 4:33 PM
  • Ah, JavaScript doesn't support consuming 'consumable' classes (non-sealed) in Win8, which includes scenarios like this where you've overridden a member of a non-sealed class.  We are investigating giving better diagnostics to help diagnose this more easily.

    Hope that helps,
    Anson Horton [MSFT]


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, March 9, 2012 8:38 PM
  • I found if there's override keyword in the code, the JS ref cache could not be generated, so, removing that keyword resolved the issue.:)
    Monday, April 9, 2012 3:17 AM