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

AttributeError exception #10

Open
msciortinoGB opened this issue Aug 24, 2022 · 4 comments
Open

AttributeError exception #10

msciortinoGB opened this issue Aug 24, 2022 · 4 comments

Comments

@msciortinoGB
Copy link

msciortinoGB commented Aug 24, 2022

Currently running into the following error when building documentation:
Exception occurred: File "Documentation\src\.venv\lib\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'

I was able to come up with a work around by changing

def parse_type_signature(sig: str, location):
    """ Parse a type declaration or usage signature """
    match = CLASS_SIG_RE.match(sig.strip())
    if not match:
        logger.warning(f'Type signature invalid: {sig}', location=location)
        return sig, None, None, None, None

to be

def parse_type_signature(sig: str, location):
    """ Parse a type declaration or usage signature """
    match = False
    if sig is not None:
        match = CLASS_SIG_RE.match(sig.strip())
    if not match:
        logger.warning(f'Type signature invalid: {sig}', location=location)
        return sig, None, None, None, None

Our script is setting up a python virtual environment, so we added a step to replace csharp.py in the venv with a custom file that has the changes.

We wanted to reach out and see if there might be something we're doing wrong on our end. But if this is an actual bug we also want to help out by letting you know.

Let us know if you need anymore details. Thanks!

@rogerbarton
Copy link

Thanks for reporting the bug.
I can make the changes to the code, but it seems like there is another issue that causes this case to occur.
Do you know which code causes this to happen?

@msciortinoGB
Copy link
Author

Hi thanks for the reply! Unfortunately I've been a bit swamped at work with other things, since it's currently working with the hot fix I did I haven't had a chance to dig into the root cause of what's going on. Any ideas for how sig could have ended up as none? When it first popped up, it didn't make much sense to me. It was able to process most of our codebases methods, but suddenly a random one caused it to blow up.

@rogerbarton
Copy link

Ok thats fine. Usually it's because of a new language feature in C# or because doxygen has changed something in its output format.
I will just apply the hotfix to the repo then. Thanks

@msciortinoGB
Copy link
Author

Awesome! And that makes sense. We're using .Net 4.8 in a Unity 2020.3.5f1 project, if that helps. Sounds like this might be a recurring error in the future as more things come out. Perhaps a logger warning mentioning this if sig is none would be good. Thanks so much!

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

2 participants