Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing 'inline' keyword, C# 7.0 Tuples #2

Open
rogerbarton opened this issue Mar 27, 2021 · 16 comments
Open

Missing 'inline' keyword, C# 7.0 Tuples #2

rogerbarton opened this issue Mar 27, 2021 · 16 comments

Comments

@rogerbarton
Copy link
Owner

Hi @rogerbarton rogerbarton,

I am trying your solution and have some warning and exception, do you have any thought about this?

-----------------
WARNING: Method signature invalid: static inline void Error (string s)
WARNING: Method signature invalid: static inline void Warning (string s)
WARNING: Method signature invalid: static inline void Log (string s)
WARNING: Method signature invalid: static inline Dictionary< ESkeletonType, Dictionary< ESkinPart, List< string > > > initAssetMaps ()
WARNING: Method signature invalid: static inline Dictionary< ESkinPart,(List< string >, List< string >)> initAssetMap2 ()
WARNING: Method signature invalid: static inline ESkeletonType getSkeletonTypeByName (string name)
WARNING: Method signature invalid: static inline ESkinPart getSkinPartByName (string name)
WARNING: Method signature invalid: static inline error _cloneSkinMesh (GameObject src, GameObject target)
WARNING: Method signature invalid: static inline async Task< bool > AutoInitAssetBundleSource ()
WARNING: Method signature invalid: static inline Task< bool > _initAssetBundle (AssetBundleSouce src)
WARNING: Method signature invalid: static inline async Task<(Object, error)> LoadAssetEx (string assetKeyName, AssetBundleSouce assetSource)
WARNING: Method signature invalid: static inline async Task<(Object, error)> LoadAsset (string assetKeyName)
WARNING: Method signature invalid: inline void SaveTextureFile (string path)
WARNING: Method signature invalid: static inline Transform rotateAnchor (Transform rootBone)
WARNING:  .....
...... many warnings like those .....

Exception:
  File "/opt/homebrew/lib/python3.9/site-packages/sphinx_csharp/csharp.py", line 237, in parse_type_signature
    match = CLASS_SIG_RE.match(sig.strip())
AttributeError: 'NoneType' object has no attribute 'strip'

Originally posted by @Feng-Seng in breathe-doc/breathe#550 (comment)

@rogerbarton
Copy link
Owner Author

The inline keyword is missing from the list of modifiers. I will add this quickly...

@Feng-Seng
Copy link

HaHa, thank you sooooooo much!!

@rogerbarton
Copy link
Owner Author

It's been added, run pip install git+https://github.com/rogerbarton/sphinx-csharp.git to get the latest version and try it again

@Feng-Seng
Copy link

Feng-Seng commented Mar 27, 2021

Thanks, it's getting better.

But I still got 2 warnings and 1 exception as follows:

----------------------
WARNING: Type signature invalid, got List< string >)
WARNING: Variable signature invalid: NSBone

Exception:
  File "/opt/homebrew/lib/python3.9/site-packages/sphinx_csharp/csharp.py", line 237, in parse_type_signature
    match = CLASS_SIG_RE.match(sig.strip())
AttributeError: 'NoneType' object has no attribute 'strip'
----------------------

Any thoughts about these?

@rogerbarton
Copy link
Owner Author

The first warning seems to be because of the brackets (.. , ...) in the original warning:

WARNING: Method signature invalid: static inline Dictionary< ESkinPart,(List< string >, List< string >)> initAssetMap2 ()

I assume this is syntax for a tuple or something similar. Parsing this as a type has not been implemented. I will have a look at this...

For the second warning, do you know which line this is coming from? maybe search your code for NSBone?

@rogerbarton
Copy link
Owner Author

I guess for now you could write Tuple<List< string >, List< string >> for this one function as a workaround. This might also fix the other warning

@Feng-Seng
Copy link

Feng-Seng commented Mar 27, 2021

For the second warning, I am not sure which line induces this warning since the NSBone has been used in several places in 2 cs files as follows.

First .cs file.

namespace xx.xxxxx
{
    //no-scale-bone
    public struct NSBone
    {
        public NSBone(Vector3 v, Quaternion q)
        {
            localPos = v;
            localRot = q;
        }
        public Vector3 localPos;
        public Quaternion localRot;
    }
    internal class NSPair
    {
        public NSPair(Vector3 v, Quaternion q)
        {
            _original.localPos = v;
            _original.localRot = q;
        }
        public NSBone _original;
        public NSBone _lastSaved;
    }
    public class Data
    {
        .......
        (NSBone, NSBone) NSBonePair(Vector3 v, Quaternion q)
        {
            return (new NSBone(v, q), new NSBone(v, q));
        }

Another .cs file

namespace xx.xxxxx
{
    ......
          public bool GetBindingPose(string name, out NSBone localTransform)
    ......
}

Could those information sufficient for you?

@Feng-Seng
Copy link

For the first warning, I will try what you said, thanks!!

@rogerbarton
Copy link
Owner Author

This is probably from the line:

(NSBone, NSBone) NSBonePair(Vector3 v, Quaternion q) {...}

So the same issue with the tuple short hand type but for the return type of the function.

@rogerbarton rogerbarton changed the title Missing 'inline' keyword Missing 'inline' keyword, C# 7.0 Tuples Mar 27, 2021
@rogerbarton
Copy link
Owner Author

I've had a look at implementing the C# 7.0 tuples, but this seems to be quite complicated. So it will not be supported for now.

@Feng-Seng
Copy link

Hi @rogerbarton ,

That's no problem.
But could you print the file / line causes the warning / error in the warning / error message?
For example, which xml (or CS) file cause this warning / error.

@Feng-Seng
Copy link

Another question is, do you know why the warning causes the exception? In usual case, only the errors could stop the execution.

Is there any way to get the result, even there are warning message?

@rogerbarton
Copy link
Owner Author

Yes, its because a None is propagated when the regex does not match. I'm currently working on cleaning things up and producing better errors...

@rogerbarton
Copy link
Owner Author

I should have probably checked this earlier, but doxygen does not yet support these C# 7.0 tuples, see doxygen/doxygen#7633. So the input for breathe is garbage.

But could you print the file / line causes the warning / error in the warning / error message?
For example, which xml (or CS) file cause this warning / error.

I have no idea how to get this information, so for now I've just set it to point to the rst file/line.

@xuhongxu96
Copy link

inline is not a keyword in C#. I think breathe should not add it in signature.

breathe-doc/breathe#668

@rogerbarton
Copy link
Owner Author

Thanks @xuhongxu96! Coming from C++ I simply assumed that C# would also have it. I will revert this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants