internal override void WriteTo(ObjectWriter writer) { base.WriteTo(writer); writer.WriteValue(_child0); writer.WriteValue(_child1); writer.WriteValue(_child2); }
public override void WriteTo(CompilationOptions options, ObjectWriter writer, CancellationToken cancellationToken) { WriteCompilationOptionsTo(options, writer, cancellationToken); var csharpOptions = (CSharpCompilationOptions)options; writer.WriteValue(csharpOptions.Usings.ToArray()); writer.WriteBoolean(csharpOptions.AllowUnsafe); }
public override void WriteTo(ParseOptions options, ObjectWriter writer, CancellationToken cancellationToken) { WriteParseOptionsTo(options, writer, cancellationToken); var csharpOptions = (CSharpParseOptions)options; writer.WriteInt32((int)csharpOptions.LanguageVersion); writer.WriteValue(options.PreprocessorSymbolNames.ToArray()); }
public void SerializeDocumentSnapshotInfo(DocumentChecksumObjectInfo info, ObjectWriter writer, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); SerializeDocumentId(info.Id, writer, cancellationToken); writer.WriteString(info.Name); writer.WriteValue(info.Folders.ToArray()); writer.WriteInt32((int)info.SourceCodeKind); writer.WriteString(info.FilePath); writer.WriteBoolean(info.IsGenerated); }
internal override void WriteTo(ObjectWriter writer) { base.WriteTo(writer); // PERF: Write the array out manually.Profiling shows that this is cheaper than converting to // an array in order to use writer.WriteValue. writer.WriteInt32(this.children.Length); for (var i = 0; i < this.children.Length; i++) { writer.WriteValue(this.children[i].Value); } }
protected void WriteCompilationOptionsTo(CompilationOptions options, ObjectWriter writer, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); writer.WriteInt32((int)options.OutputKind); writer.WriteBoolean(options.ReportSuppressedDiagnostics); writer.WriteString(options.ModuleName); writer.WriteString(options.MainTypeName); writer.WriteString(options.ScriptClassName); writer.WriteInt32((int)options.OptimizationLevel); writer.WriteBoolean(options.CheckOverflow); // REVIEW: is it okay this being not part of snapshot? writer.WriteString(options.CryptoKeyContainer); writer.WriteString(options.CryptoKeyFile); writer.WriteValue(options.CryptoPublicKey.ToArray()); writer.WriteBoolean(options.DelaySign.HasValue); if (options.DelaySign.HasValue) { writer.WriteBoolean(options.DelaySign.Value); } writer.WriteInt32((int)options.Platform); writer.WriteInt32((int)options.GeneralDiagnosticOption); writer.WriteInt32(options.WarningLevel); // REVIEW: I don't think there is a guarantee on ordering of elements in the immutable dictionary. // unfortunately, we need to sort them to make it deterministic writer.WriteInt32(options.SpecificDiagnosticOptions.Count); foreach (var kv in options.SpecificDiagnosticOptions.OrderBy(o => o.Key)) { writer.WriteString(kv.Key); writer.WriteInt32((int)kv.Value); } writer.WriteBoolean(options.ConcurrentBuild); writer.WriteBoolean(options.Deterministic); writer.WriteBoolean(options.PublicSign); // REVIEW: What should I do with these. we probably need to implement either out own one // or somehow share these as service.... // // XmlReferenceResolver xmlReferenceResolver // SourceReferenceResolver sourceReferenceResolver // MetadataReferenceResolver metadataReferenceResolver // AssemblyIdentityComparer assemblyIdentityComparer // StrongNameProvider strongNameProvider }
private unsafe void WriteTo(MetadataReader reader, ObjectWriter writer, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); var length = reader.MetadataLength; // TODO: any way to avoid allocating byte array here? var bytes = new byte[length]; Marshal.Copy((IntPtr)reader.MetadataPointer, bytes, 0, length); writer.WriteValue(bytes); }
private void WriteMvidTo(ModuleMetadata metadata, ObjectWriter writer, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); writer.WriteInt32((int)metadata.Kind); var metadataReader = metadata.GetMetadataReader(); var mvidHandle = metadataReader.GetModuleDefinition().Mvid; var guid = metadataReader.GetGuid(mvidHandle); writer.WriteValue(guid.ToByteArray()); }
private void WriteTo(MetadataReferenceProperties properties, ObjectWriter writer, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); writer.WriteInt32((int)properties.Kind); writer.WriteValue(properties.Aliases.ToArray()); writer.WriteBoolean(properties.EmbedInteropTypes); }
protected virtual void WriteTo(ObjectWriter writer) { writer.WriteValue(_messageProvider); writer.WriteCompressedUInt((uint)_errorCode); writer.WriteInt32((int)_effectiveSeverity); writer.WriteInt32((int)_defaultSeverity); int count = (_arguments != null) ? _arguments.Length : 0; writer.WriteCompressedUInt((uint)count); if (count > 0) { foreach (var arg in _arguments) { writer.WriteString(arg.ToString()); } } }
public void SerializeProjectReference(ProjectReference reference, ObjectWriter writer, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); reference.ProjectId.WriteTo(writer); writer.WriteValue(reference.Aliases.ToArray()); writer.WriteBoolean(reference.EmbedInteropTypes); }
internal virtual void WriteTo(ObjectWriter writer) { var kindBits = (UInt16)_kind; var hasDiagnostics = this.GetDiagnostics().Length > 0; var hasAnnotations = this.GetAnnotations().Length > 0; if (hasDiagnostics || hasAnnotations) { kindBits |= ExtendedSerializationInfoMask; } writer.WriteUInt16(kindBits); if (hasDiagnostics || hasAnnotations) { writer.WriteValue(hasDiagnostics ? this.GetDiagnostics() : null); writer.WriteValue(hasAnnotations ? this.GetAnnotations() : null); } }
public void WriteTo(ObjectWriter writer) { Id.WriteTo(writer); writer.WriteString(Name); writer.WriteValue(Folders.ToArray()); writer.WriteInt32((int)SourceCodeKind); writer.WriteString(FilePath); writer.WriteBoolean(IsGenerated); }
private void WriteTo(MetadataReader reader, ObjectWriter writer, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); var blockFieldInfo = reader.GetType().GetTypeInfo().GetDeclaredField("Block"); var block = blockFieldInfo.GetValue(reader); // TODO: once things become public API, change it to copy stream over byte* and length from metadata reader var toArrayFieldInfo = block.GetType().GetTypeInfo().GetDeclaredMethod("ToArray"); var array = (byte[])toArrayFieldInfo.Invoke(block, null); writer.WriteValue(array); }
internal override void WriteTo(ObjectWriter writer) { base.WriteTo(writer); writer.WriteValue(this.LeadingField); writer.WriteValue(this.TrailingField); }
internal override void WriteTo(ObjectWriter writer) { base.WriteTo(writer); writer.WriteValue(_leading); writer.WriteValue(_trailing); }
public static void SerializeDocumentId(DocumentId documentId, ObjectWriter writer, CancellationToken cancellationToken) { SerializeProjectId(documentId.ProjectId, writer, cancellationToken); writer.WriteValue(documentId.Id.ToByteArray()); writer.WriteString(documentId.DebugName); }
public static void SerializeProjectId(ProjectId projectId, ObjectWriter writer, CancellationToken cancellationToken) { writer.WriteValue(projectId.Id.ToByteArray()); writer.WriteString(projectId.DebugName); }
public void SerializeSolutionId(SolutionId solutionId, ObjectWriter writer, CancellationToken cancellationToken) { writer.WriteValue(solutionId.Id.ToByteArray()); writer.WriteString(solutionId.DebugName); }
protected virtual void WriteTo(ObjectWriter writer) { writer.WriteValue(this.messageProvider); writer.WriteCompressedUInt((uint)this.errorCode); writer.WriteBoolean(this.isWarningAsError); int count = (this.arguments != null) ? arguments.Length : 0; writer.WriteCompressedUInt((uint)count); if (count > 0) { foreach (var arg in this.arguments) { writer.WriteString(arg.ToString()); } } }
void IObjectWritable.WriteTo(ObjectWriter writer) { writer.WriteValue(_resourceSource); writer.WriteString(_nameOfLocalizableResource); var length = (uint)_formatArguments.Length; writer.WriteCompressedUInt(length); for (int i = 0; i < length; i++) { writer.WriteString(_formatArguments[i]); } }
protected virtual void WriteTo(ObjectWriter writer) { writer.WriteValue(_messageProvider); writer.WriteInt32(_errorCode); writer.WriteInt32((int)_effectiveSeverity); writer.WriteInt32((int)_defaultSeverity); int count = _arguments?.Length ?? 0; writer.WriteInt32(count); if (count > 0) { foreach (var arg in _arguments) { writer.WriteString(arg.ToString()); } } }