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

ExtractMetadataException - Error extracting metadata for *** While writing a quoted scalar, found an orphaned high surrogate #1817

Closed
Shazwazza opened this issue Jun 30, 2017 · 5 comments
Assignees
Labels
bug A bug to fix dotnet Generate .NET API reference docs
Milestone

Comments

@Shazwazza
Copy link

Title

DocFx 2.17 didn't have this issue however 2.19.2 does. When I run the docfx.exe build I get this error with our current build setup.

I'm not sure if it's something in particular with some formatting within code comments, maybe some odd characters or just something I've done that isn't supported after 2.17.x versions. Any help is appreciated!

Functional impact

The docs cannot build

Minimal repro steps

Clone this repo at this branch: https://github.com/Shazwazza/lucenenet/tree/docfx-apidocs

This is trying to build API docs for the upcoming Lucene.NET 4.8 but fails. Currently the build file is using v2.17.7 but if it's changed to v2.19.2 it fill fail.

You can test this by running the build script with powershell: /apidocs/docs.ps1

If you then change this docs.ps1 file to reference the v2.19.2 instead (on line 42), then delete the /apidocs/tools folder and re-run the script it will fail with the exception below

Expected result

The build is successful

Actual result

The build throws an exception

Further technical details

This is the exception that is thrown:

[17-06-30 02:27:19.762]Error:System.AggregateException: One or more errors occurred. ---> Microsoft.DocAsCode.Exceptions.ExtractMetadataException: Err
or extracting metadata for X:/Projects/Lucene.Net/lucenenet.4.x/src/Lucene.Net/Lucene.Net.csproj: While writing a quoted scalar, found an orphaned hig
h surrogate. ---> YamlDotNet.Core.SyntaxErrorException: While writing a quoted scalar, found an orphaned high surrogate.
   at YamlDotNet.Core.Emitter.WriteDoubleQuotedScalar(String value, Boolean allowBreaks)
   at YamlDotNet.Core.Emitter.EmitScalar(ParsingEvent evt)
   at YamlDotNet.Core.Emitter.EmitNode(ParsingEvent evt, Boolean isRoot, Boolean isMapping, Boolean isSimpleKey)
   at YamlDotNet.Core.Emitter.EmitBlockMappingValue(ParsingEvent evt, Boolean isSimple)
   at YamlDotNet.Core.Emitter.Emit(ParsingEvent event)
   at YamlDotNet.Serialization.EventEmitters.TypeAssigningEventEmitter.Emit(ScalarEventInfo eventInfo, IEmitter emitter)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseDictionary[TContext](IObjectDescri
ptor dictionary, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescri
ptor value, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescri
ptor value, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseList[TContext](IObjectDescriptor v
alue, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescri
ptor value, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseList[TContext](IObjectDescriptor v
alue, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescri
ptor value, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseList[TContext](IObjectDescriptor v
alue, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescri
ptor value, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.YamlSerializer.EmitDocument(IEmitter emitter, IObjectDescriptor graph)
   at Microsoft.DocAsCode.Common.YamlUtility.Serialize(TextWriter writer, Object graph, String comments)
   at Microsoft.DocAsCode.Common.YamlUtility.Serialize(String path, Object graph, String comments)
   at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<GetMetadataFromProjectLevelCacheAsync>d__27`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<SaveAllMembersFromCacheAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<ExtractMetadataAsync>d__12.MoveNext()
   --- End of inner exception stack trace ---
   at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<ExtractMetadataAsync>d__12.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.DocAsCode.SubCommands.MetadataCommand.ExecCore()
   at Microsoft.DocAsCode.SubCommands.MetadataCommand.Exec(SubCommandRunningContext context)
   at Microsoft.DocAsCode.Program.ExecSubCommand(String[] args)
---> (Inner Exception #0) Microsoft.DocAsCode.Exceptions.ExtractMetadataException: Error extracting metadata for X:/Projects/Lucene.Net/lucenenet.4.x/
src/Lucene.Net/Lucene.Net.csproj: While writing a quoted scalar, found an orphaned high surrogate. ---> YamlDotNet.Core.SyntaxErrorException: While wr
iting a quoted scalar, found an orphaned high surrogate.
   at YamlDotNet.Core.Emitter.WriteDoubleQuotedScalar(String value, Boolean allowBreaks)
   at YamlDotNet.Core.Emitter.EmitScalar(ParsingEvent evt)
   at YamlDotNet.Core.Emitter.EmitNode(ParsingEvent evt, Boolean isRoot, Boolean isMapping, Boolean isSimpleKey)
   at YamlDotNet.Core.Emitter.EmitBlockMappingValue(ParsingEvent evt, Boolean isSimple)
   at YamlDotNet.Core.Emitter.Emit(ParsingEvent event)
   at YamlDotNet.Serialization.EventEmitters.TypeAssigningEventEmitter.Emit(ScalarEventInfo eventInfo, IEmitter emitter)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseDictionary[TContext](IObjectDescri
ptor dictionary, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescri
ptor value, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescri
ptor value, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseList[TContext](IObjectDescriptor v
alue, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescri
ptor value, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseList[TContext](IObjectDescriptor v
alue, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescri
ptor value, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseList[TContext](IObjectDescriptor v
alue, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseProperties[TContext](IObjectDescri
ptor value, Object visitor, Int32 currentDepth, Object context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.TraverseObject[TContext](IObjectDescriptor
 value, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.ObjectGraphTraversalStrategies.FullObjectGraphTraversalStrategy.Traverse[TContext](IObjectDescriptor value
, IObjectGraphVisitor`1 visitor, Int32 currentDepth, TContext context)
   at Microsoft.DocAsCode.YamlSerialization.YamlSerializer.EmitDocument(IEmitter emitter, IObjectDescriptor graph)
   at Microsoft.DocAsCode.Common.YamlUtility.Serialize(TextWriter writer, Object graph, String comments)
   at Microsoft.DocAsCode.Common.YamlUtility.Serialize(String path, Object graph, String comments)
   at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<GetMetadataFromProjectLevelCacheAsync>d__27`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<SaveAllMembersFromCacheAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<ExtractMetadataAsync>d__12.MoveNext()
   --- End of inner exception stack trace ---
   at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<ExtractMetadataAsync>d__12.MoveNext()<---



Build failed.
@vwxyzh
Copy link
Contributor

vwxyzh commented Jul 6, 2017

Root cause:
Field Lucene.Net.Support.Character.MAX_SURROGATE defines the max surrogate character.
And we try to write this character into the yaml file (the constant value).
But yaml cannot write surrogate character.

@Shazwazza
Copy link
Author

Thanks for finding this. Ok that gives me a starting point to look into how to either filter this out or fix the issue somehow. Any tips are much appreciated.

@Shazwazza
Copy link
Author

I've got this working now by filtering out these constant values with the docfx filter. Thanks for the help!

I'm unsure if this issue can be fixed or if the workaround to ensure these type of edge cases are just filtered out is sufficient?

@vwxyzh
Copy link
Contributor

vwxyzh commented Jul 7, 2017

@Shazwazza I create a workaround in our code, and I will create an issue in Roslyn project.

@vwxyzh
Copy link
Contributor

vwxyzh commented Jul 7, 2017

@Shazwazza this workaround will be released in v2.20 (next Monday).

@vicancy vicancy closed this as completed Jul 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug to fix dotnet Generate .NET API reference docs
Projects
None yet
Development

No branches or pull requests

3 participants