appledoc icon indicating copy to clipboard operation
appledoc copied to clipboard

NSInvalidArgumentException issue

Open cfjedimaster opened this issue 10 years ago • 21 comments

I'm getting this error when running appledoc on a set of code:

Oops, something went wrong... NSInvalidArgumentException: -[__NSCFString appendString:]: nil argument @ 0 CoreFoundation 0x00007fff95ea825c __exceptionPreprocess + 172 @ 1 libobjc.A.dylib 0x00007fff8b5b2e75 objc_exception_throw + 43 @ 2 CoreFoundation 0x00007fff95ea810c +[NSException raise:format:] + 204 @ 3 CoreFoundation 0x00007fff95e77def mutateError + 159 @ 4 appledoc 0x000000010cd34a3d appledoc + 84541 @ 5 appledoc 0x000000010cd3c293 appledoc + 115347 @ 6 appledoc 0x000000010cd343bc appledoc + 82876 @ 7 appledoc 0x000000010cd33e55 appledoc + 81493 @ 8 appledoc 0x000000010cd30f94 appledoc + 69524 @ 9 appledoc 0x000000010cd2ecb3 appledoc + 60595 @ 10 appledoc 0x000000010cd302c1 appledoc + 66241 @ 11 appledoc 0x000000010cd2ff6a appledoc + 65386 @ 12 appledoc 0x000000010cd2fba1 appledoc + 64417 @ 13 appledoc 0x000000010cd2e960 appledoc + 59744 @ 14 appledoc 0x000000010cd23540 appledoc + 13632 @ 15 appledoc 0x000000010cd21d57 appledoc + 7511 @ 16 appledoc 0x000000010cd21ec0 appledoc + 7872 @ 17 appledoc 0x000000010cd2204b appledoc + 8267 @ 18 appledoc 0x000000010cd21304 appledoc + 4868

When I increase the verbosity, I get this rightbefore (and I'm going to rename some stuff due to NDA-lameness):

Registering typedef block AdobeFooNetworkResponseCompletion... Matched AdobeFooNetworkResponseProgress typedef block definition at line 55.

The code in question is the last line of the file:

typedef void(^AdobeFooNetworkResponseProgress)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpected);

Which as far as I know looks fine to me.

cfjedimaster avatar Aug 06 '14 19:08 cfjedimaster

Same here. At verbose 6. INFO | Parsing source code from './MyCompanyHybrid/Plugins/MCNativeXHRPlugin.h'... DEBUG | Parsing objective-c objects... DEBUG | Initializing tokenizer... DEBUG | Initializing class with name MCNativeXHRPlugin... DEBUG | Initializing adopted protocols provider for MCNativeXHRPlugin... DEBUG | Initializing ivars provider for MCNativeXHRPlugin... DEBUG | Initializing methods provider for MCNativeXHRPlugin... DEBUG | Matched MCNativeXHRPlugin class definition at line 10. DEBUG | Resetting comments... DEBUG | Matched superclass CDVPlugin. DEBUG | Registering class MCNativeXHRPlugin... VERBOSE | Matched MCRequestFinishedBlock typedef block definition at line 14. Oops, something went wrong... NSInvalidArgumentException: -[__NSCFString appendString:]: nil argument @ 0 CoreFoundation 0x00007fff8929325c __exceptionPreprocess + 172 @ 1 libobjc.A.dylib 0x00007fff8eac6e75 objc_exception_throw + 43 @ 2 CoreFoundation 0x00007fff8929310c +[NSException raise:format:] + 204 @ 3 CoreFoundation 0x00007fff89262def mutateError + 159 @ 4 appledoc 0x000000010450fe2d appledoc + 85549 @ 5 appledoc 0x0000000104517683 appledoc + 116355 @ 6 appledoc 0x000000010450f7ac appledoc + 83884 @ 7 appledoc 0x000000010450f245 appledoc + 82501 @ 8 appledoc 0x000000010450c384 appledoc + 70532 @ 9 appledoc 0x000000010450a0a3 appledoc + 61603 @ 10 appledoc 0x000000010450b6b1 appledoc + 67249 @ 11 appledoc 0x000000010450b35a appledoc + 66394 @ 12 appledoc 0x000000010450b504 appledoc + 66820 @ 13 appledoc 0x000000010450b504 appledoc + 66820 @ 14 appledoc 0x000000010450af91 appledoc + 65425 @ 15 appledoc 0x0000000104509d50 appledoc + 60752 @ 16 appledoc 0x00000001044fe930 appledoc + 14640 @ 17 appledoc 0x00000001044fd147 appledoc + 8519 @ 18 appledoc 0x00000001044fd2b0 appledoc + 8880 @ 19 appledoc 0x00000001044fd43b appledoc + 9275 @ 20 appledoc 0x00000001044fc6f4 appledoc + 5876

NathanHazout avatar Aug 10 '14 13:08 NathanHazout

I have been able to reproduce with a simple .h file:

          typedef void (^Foo)(Bar*);

and calling appledoc -p X -c X file.h Crashes at GBObjectiveCParser.m:matchTypedefBlockDefinitionForProvider line 503.

Seems that line 503 assumes that a name will follow "Bar*", consumes it and the next loop has already consumed over the ";".

ramonpoca avatar Aug 18 '14 14:08 ramonpoca

I'm running into the same issue, just installed today (August 18th 2014)

appledoc version: 2.2 (build 963)

Oops, something went wrong... NSInvalidArgumentException: -[__NSCFString appendString:]: nil argument @ 0 CoreFoundation 0x00007fff85687f3c __exceptionPreprocess + 172 @ 1 libobjc.A.dylib 0x00007fff873c16de objc_exception_throw + 43 @ 2 CoreFoundation 0x00007fff85687ded +[NSException raise:format:] + 205 @ 3 CoreFoundation 0x00007fff8564566f mutateError + 159 @ 4 appledoc 0x0000000108cbf40d appledoc + 87053 @ 5 appledoc 0x0000000108cc6c63 appledoc + 117859 @ 6 appledoc 0x0000000108cbed8c appledoc + 85388 @ 7 appledoc 0x0000000108cbe825 appledoc + 84005 @ 8 appledoc 0x0000000108cbb964 appledoc + 72036 @ 9 appledoc 0x0000000108cb9683 appledoc + 63107 @ 10 appledoc 0x0000000108cbac91 appledoc + 68753 @ 11 appledoc 0x0000000108cba93a appledoc + 67898 @ 12 appledoc 0x0000000108cbaae4 appledoc + 68324 @ 13 appledoc 0x0000000108cbaae4 appledoc + 68324 @ 14 appledoc 0x0000000108cbaae4 appledoc + 68324 @ 15 appledoc 0x0000000108cba571 appledoc + 66929 @ 16 appledoc 0x0000000108cb9330 appledoc + 62256 @ 17 appledoc 0x0000000108cadf10 appledoc + 16144 @ 18 appledoc 0x0000000108cac727 appledoc + 10023 @ 19 appledoc 0x0000000108cac890 appledoc + 10384 @ 20 appledoc 0x0000000108caca1b appledoc + 10779 @ 21 appledoc 0x0000000108cabcd4 appledoc + 7380 @ 22 ??? 0x000000000000001e 0x0 + 30 Command /bin/sh failed with exit code 250

Kenrik avatar Aug 18 '14 18:08 Kenrik

I am running into the same issue (August 28th 2014)

acajic avatar Aug 26 '14 11:08 acajic

I have the same issue, crashing on:

typedef void (^QRHandlerBlock)(id <NSFastEnumeration> symbols);

With:

Matched QRHandlerBlock typedef block definition at line 4.
Oops, something went wrong...
NSInvalidArgumentException: -[__NSCFString appendString:]: nil argument
  @ 0   CoreFoundation                      0x00007fff85b0b25c __exceptionPreprocess + 172
  @ 1   libobjc.A.dylib                     0x00007fff88515e75 objc_exception_throw + 43
  @ 2   CoreFoundation                      0x00007fff85b0b10c +[NSException raise:format:] + 204
  @ 3   CoreFoundation                      0x00007fff85adadef mutateError + 159
  @ 4   appledoc                            0x000000010630b2ed appledoc + 86765
  ...

dan-mac avatar Aug 28 '14 00:08 dan-mac

I'm stumbling upon the same error as everybody else here. Anybody found a solution/workaround yet?


Oops, something went wrong...
NSInvalidArgumentException: -[__NSCFString appendString:]: nil argument
  @ 0   CoreFoundation                      0x00007fff92e1925c __exceptionPreprocess + 172
  @ 1   libobjc.A.dylib                     0x00007fff8a87ee75 objc_exception_throw + 43
  @ 2   CoreFoundation                      0x00007fff92e1910c +[NSException raise:format:] + 204
  @ 3   CoreFoundation                      0x00007fff92de8def mutateError + 159
  @ 4   appledoc                            0x000000010c1cac8d appledoc + 85133
  @ 5   appledoc                            0x000000010c1d24e3 appledoc + 115939
  @ 6   appledoc                            0x000000010c1ca60c appledoc + 83468
  @ 7   appledoc                            0x000000010c1ca0a5 appledoc + 82085
  @ 8   appledoc                            0x000000010c1c71e4 appledoc + 70116
  @ 9   appledoc                            0x000000010c1c4f03 appledoc + 61187
  @ 10  appledoc                            0x000000010c1c6511 appledoc + 66833
  @ 11  appledoc                            0x000000010c1c61ba appledoc + 65978
  @ 12  appledoc                            0x000000010c1c6364 appledoc + 66404
  @ 13  appledoc                            0x000000010c1c6364 appledoc + 66404
  @ 14  appledoc                            0x000000010c1c6364 appledoc + 66404
  @ 15  appledoc                            0x000000010c1c5df1 appledoc + 65009
  @ 16  appledoc                            0x000000010c1c4bb0 appledoc + 60336
  @ 17  appledoc                            0x000000010c1b9790 appledoc + 14224
  @ 18  appledoc                            0x000000010c1b7fa7 appledoc + 8103
  @ 19  appledoc                            0x000000010c1b8110 appledoc + 8464
  @ 20  appledoc                            0x000000010c1b829b appledoc + 8859
  @ 21  appledoc                            0x000000010c1b7554 appledoc + 5460
  @ 22  ???                                 0x000000000000000a 0x0 + 10

dusker avatar Sep 04 '14 10:09 dusker

Blocks are not supported at present. Previously appledoc ignored them, but seems like latest changes broke that.

tomaz avatar Sep 04 '14 12:09 tomaz

first ... I love your work as well as my beautyful documentation made by appleDoc. ;-)

Nevertheless I run into the same errors on block definitions. Can you name a GIT revision in which blocks are properly ignored? I would prefer building my documentation for the whole project and editing the final HTML files where block explanations are missing later.

Thanks in advance!

he1ko avatar Sep 19 '14 06:09 he1ko

Sorry, if I might not have noticed the right entry in your docs - I think for the moment it would be helpful to provide a source comment type like

/**
 * ###PLEASE_IGNORE###
 */
typedef void(^myMethodCompletionHandler)(BOOL*);

I would add it above block definitions and their usage.

he1ko avatar Sep 19 '14 06:09 he1ko

Not sure which commit caused regression. If you're in time, try git bisect - start with one of older commits - ar least prior to beginning of this issue. Then it should take couple iterations until it'll point out regression...

tomaz avatar Sep 19 '14 06:09 tomaz

Thank you. No problem, docs are important for me - in the current project more than ever… so I’ll have the time. If I find a useful revision ignoring blocks, I’ll reply this to you so you can post it in the bug report, if you like.

bye…

Am 19.09.2014 um 08:47 schrieb tomaz [email protected]:

Not sure which commit caused regression. If you're in time, try git bisect - start with one of older commits - ar least prior to beginning of this issue. Then it should take couple iterations until it'll point out regression...

— Reply to this email directly or view it on GitHub.

he1ko avatar Sep 19 '14 06:09 he1ko

Did anyone determine that which revision works? I'm on appledoc version: 2.2 (build 963) as well and seeing this issue. My other teammates are on v2.2 as well, not sure if they have the latest build, but aren't seeing an error with the same code we are trying to document.

I also tried the appledoc22 in brew but that one doesn't compile for me with an error about garbage collection is no longer supported.

prisalex avatar Sep 30 '14 21:09 prisalex

I haven’t found a revision that works both for ARC and with blocks.

he1ko avatar Oct 01 '14 03:10 he1ko

Latest master should compile on ARC - for compile with Xcode 5.1+. Not sure of homebrew status, I'm not managing that.

Block syntax is still not supported.

tomaz avatar Oct 01 '14 07:10 tomaz

I'm seeing the problem with Block syntax as well. Please fix ASAP :-D

sseyod avatar Oct 01 '14 13:10 sseyod

Let's hope for community contribution then ;)

tomaz avatar Oct 01 '14 13:10 tomaz

Hi tomaz,

As requested :) I've run this through XCode, and by commenting-out the code in GBObjectiveCParser.m from lines 490 to 517, the code then seems to work 100% OK (from my limited testing).

  /*
    if (![[self.tokenizer lookahead: 2] matches: @"void"]) {

... ... ... [values addObject: newArg];

             *consume = NO;
         }];
    }

*/ I hope this helps!

Pete

sseyod avatar Oct 01 '14 14:10 sseyod

My particular problem code was of this form:

typedef void (^TCallWhenDone) ()

sseyod avatar Oct 01 '14 14:10 sseyod

same problem with: typedef void (^IconClickBlock)(NSInteger); comment out generates documentation

bochos avatar Oct 01 '14 15:10 bochos

Similar to above - but with a more complete call stack:

It looks like in GBCommentsProcessor.m: (BOOL)matchesObject:(id)object - is passed in a GBEnumConstantData object. This class does not match any of the handled "if" conditions and also does not implement the "methodSelector" message - which causes the app to crash.

2014-10-06 11:15:17.478 appledoc[4288:507] -[GBEnumConstantData methodSelector]: unrecognized selector sent to instance 0x7fcc739ede60 appledoc version: 2.2 (build 963)

Initializing... Parsing source files... Processing parsed data... Oops, something went wrong... NSInvalidArgumentException: -[GBEnumConstantData methodSelector]: unrecognized selector sent to instance 0x7fcc739ede60 @ 0 CoreFoundation 0x00007fff85cd425c exceptionPreprocess + 172 @ 1 libobjc.A.dylib 0x00007fff8c8c0e75 objc_exception_throw + 43 @ 2 CoreFoundation 0x00007fff85cd712d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 @ 3 CoreFoundation 0x00007fff85c32272 __forwarding + 1010 @ 4 CoreFoundation 0x00007fff85c31df8 _CF_forwarding_prep_0 + 120 @ 5 appledoc 0x00000001074f837a -[GBCrossRefData matchesObject:] + 1034 @ 6 appledoc 0x0000000107502ece -[GBCommentsProcessor stringByConvertingSimpleCrossReferencesInString:searchRange:flags:] + 1486 @ 7 appledoc 0x000000010750281c -[GBCommentsProcessor stringByConvertingCrossReferencesInString:withFlags:] + 2236 @ 8 appledoc 0x0000000107501e05 -[GBCommentsProcessor stringByPreprocessingNonLinkString:withFlags:] + 5733 @ 9 appledoc 0x00000001075004a3 -[GBCommentsProcessor stringByPreprocessingString:withFlags:] + 1859 @ 10 appledoc 0x00000001074ffb7f -[GBCommentsProcessor commentComponentByPreprocessingString:withFlags:] + 431 @ 11 appledoc 0x00000001074fac3b -[GBCommentsProcessor registerShortDescriptionFromLines:range:removePrefix:] + 683 @ 12 appledoc 0x00000001074fa642 -[GBCommentsProcessor processCommentBlockInLines:blockRange:shortRange:] + 2338 @ 13 appledoc 0x00000001074f96b6 -[GBCommentsProcessor processComment:withContext:store:] + 2358 @ 14 appledoc 0x00000001074f8cee -[GBCommentsProcessor processCommentForObject:withContext:store:] + 414 @ 15 appledoc 0x000000010750c35a -[GBProcessor processCommentForObject:] + 570 @ 16 appledoc 0x000000010750be28 -[GBProcessor processConstantsFromProvider:] + 632 @ 17 appledoc 0x000000010750a489 -[GBProcessor processConstants] + 729 @ 18 appledoc 0x0000000107509234 -[GBProcessor processObjectsFromStore:] + 612 @ 19 appledoc 0x00000001074a0e26 -[GBAppledocApplication application:runWithArguments:] + 2582 @ 20 appledoc 0x000000010749e22b -[DDCliApplication runWithDelegate:arguments:] + 427 @ 21 appledoc 0x000000010749e4fb -[DDCliApplication runWithClass:] + 283 @ 22 appledoc 0x000000010749e773 DDCliAppRunWithClass + 99 @ 23 appledoc 0x000000010749cf47 main + 55 @ 24 appledoc 0x000000010749cf04 start + 52 @ 25 ??? 0x0000000000000028 0x0 + 40 Command /bin/sh failed with exit code 250

JeremyBlastMotion avatar Oct 06 '14 18:10 JeremyBlastMotion

I resolved the issue locally by adding another else if to Processing/GBCommentsProcessor.m - matchesObject: around line 52.

else if ([object isKindOfClass:[GBEnumConstantData class]]) return NO;

JeremyBlastMotion avatar Dec 31 '14 20:12 JeremyBlastMotion