sphinx-csharp
sphinx-csharp copied to clipboard
AttributeError exception
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!
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?
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.
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
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!