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

Got System.NullReferenceException when running DefaultDocumentation #124

Open
HuiyunPeng opened this issue Aug 18, 2022 · 3 comments
Open
Labels
bug Something isn't working

Comments

@HuiyunPeng
Copy link

I'm not able to run default documentation on one of my c# projects. Is this caused by default documentation or ICSharpCode.Decompiler?

Stack trace:

|INFO|DefaultDocumentation|Starting DefaultDocumentation with those settings:
    AssemblyFile: c:\myFile.dll
    DocumentationFile: c:\myFile.xml
    ProjectDirectory:
    OutputDirectory: c:\myDirectory
    AssemblyPageName: index
    GeneratedAccessModifiers: Public, Protected, ProtectedInternal
    GeneratedPages: Assembly, Namespaces, Types, Members
    IncludeUndocumentedItems: False
    LinksOutputFile:
    LinksBaseUrl:
    ExternLinksFiles:

 Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
     at ICSharpCode.Decompiler.TypeSystem.AccessibilityExtensions.EffectiveAccessibility(IEntity entity) in /_/ICSharpCode.Decompiler/TypeSystem/Accessibility.cs:line 134
     at DefaultDocumentation.Internal.DocItemReader.<.ctor>g__IsGenerated|5_0(IEntity entity, <>c__DisplayClass5_0& ) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Internal\DocItemReader.cs:line 29
     at DefaultDocumentation.Internal.DocItemReader.<.ctor>g__IsGenerated|5_0(IEntity entity, <>c__DisplayClass5_0& ) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Internal\DocItemReader.cs:line 35
     at DefaultDocumentation.Internal.DocItemReader..ctor(Settings settings) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Internal\DocItemReader.cs:line 157
     at DefaultDocumentation.Internal.DocItemReader.GetItems(Settings settings) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Internal\DocItemReader.cs:line 354
     at DefaultDocumentation.Generator..ctor(Target loggerTarget, IRawSettings settings) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Generator.cs:line 116
     at DefaultDocumentation.Generator.Execute(Target loggerTarget, IRawSettings settings) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Generator.cs:line 195
     at DefaultDocumentation.Program.<>c.<Main>b__0_1(SettingsArgs a) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Console\Program.cs:line 24
     at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
     at DefaultDocumentation.Program.Main(String[] args) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Console\Program.cs:line 18
@Doraku
Copy link
Owner

Doraku commented Aug 21, 2022

Hum from the stack trace it seems it fails to get the DeclaringTypeDefinition for an explicit interface implementation method. Can you provide the code that generate this error? You can get more infos by changing the LogLevel to pinpoint the member it is handling during the exception if needed.

@HuiyunPeng
Copy link
Author

This is the member that generate this error.

/// <summary>
/// NOTE: must be kept in sync with Execute{TResult}/>
/// </summary>
Task<TResult> AsyncQueryProvider.ExecuteAsync<TResult>(Expression expression, CancellationToken cancellationToken)
{
	...
}

@Doraku
Copy link
Owner

Doraku commented Sep 20, 2022

sorry for the laaaaate reply, I have been pretty busy with work and completely disconnected for some nice holydays.
It seems related to an old issue someone reported to me, for some reason there is some dependencies that doesn't manage to be loaded and ICsharpCode.Decompiler can't find the full type information. I'll need to test (can you provide the package reference/dependencies from where AsyncQueryProvider is coming from?) just to be sure but I will probably need to safe guard against those cases :/

@Doraku Doraku added the bug Something isn't working label Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants