本文整理汇总了C#中System.Reflection.Metadata.MetadataReader.GetGuid方法的典型用法代码示例。如果您正苦于以下问题:C# MetadataReader.GetGuid方法的具体用法?C# MetadataReader.GetGuid怎么用?C# MetadataReader.GetGuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Metadata.MetadataReader
的用法示例。
在下文中一共展示了MetadataReader.GetGuid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyModuleMvid
internal static void VerifyModuleMvid(int generation, MetadataReader previousReader, MetadataReader currentReader)
{
var previousModule = previousReader.GetModuleDefinition();
var currentModule = currentReader.GetModuleDefinition();
Assert.Equal(previousReader.GetGuid(previousModule.Mvid), currentReader.GetGuid(currentModule.Mvid));
Assert.Equal(generation - 1, previousModule.Generation);
Assert.Equal(generation, currentModule.Generation);
if (generation == 1)
{
Assert.True(previousModule.GenerationId.IsNil);
Assert.True(previousModule.BaseGenerationId.IsNil);
Assert.False(currentModule.GenerationId.IsNil);
Assert.True(currentModule.BaseGenerationId.IsNil);
}
else
{
Assert.False(currentModule.GenerationId.IsNil);
Assert.False(currentModule.BaseGenerationId.IsNil);
Assert.Equal(previousReader.GetGuid(previousModule.GenerationId), currentReader.GetGuid(currentModule.BaseGenerationId));
}
Assert.NotEqual(default(Guid), currentReader.GetGuid(currentModule.GenerationId));
}
示例2: ReadMvid
private static Guid ReadMvid(SystemMetadataReader metadataReader)
{
var mvidHandle = metadataReader.GetModuleDefinition().Mvid;
return metadataReader.GetGuid(mvidHandle);
}
示例3: BuildForEnc
public unsafe int BuildForEnc(object pUpdatePE)
{
try
{
log.Write("Applying changes to {0}", _vsProject.DisplayName);
Debug.Assert(_encService.EditSession != null);
Debug.Assert(!_encService.EditSession.StoppedAtException);
// Non-debuggable project has no changes.
Debug.Assert(IsDebuggable);
if (_changesApplied)
{
log.Write("Changes already applied to {0}, can't apply again", _vsProject.DisplayName);
throw ExceptionUtilities.Unreachable;
}
// The debugger always calls GetENCBuildState right before BuildForEnc.
Debug.Assert(_projectBeingEmitted != null);
Debug.Assert(_lastEditSessionSummary == GetProjectAnalysisSummary(_projectBeingEmitted));
// The debugger should have called GetENCBuildState before calling BuildForEnc.
// Unfortunately, there is no way how to tell the debugger that the changes were not significant,
// so we'll to emit an empty delta. See bug 839558.
Debug.Assert(_lastEditSessionSummary == ProjectAnalysisSummary.ValidInsignificantChanges ||
_lastEditSessionSummary == ProjectAnalysisSummary.ValidChanges);
var updater = (IDebugUpdateInMemoryPE2)pUpdatePE;
if (_committedBaseline == null)
{
var hr = MarshalPdbReader(updater, out _pdbReaderObjAsStream);
if (hr != VSConstants.S_OK)
{
return hr;
}
_committedBaseline = EmitBaseline.CreateInitialBaseline(_metadata, GetBaselineEncDebugInfo);
}
// ISymUnmanagedReader can only be accessed from an MTA thread,
// so dispatch it to one of thread pool threads, which are MTA.
var emitTask = Task.Factory.SafeStartNew(EmitProjectDelta, CancellationToken.None, TaskScheduler.Default);
Deltas delta;
using (NonReentrantContext)
{
delta = emitTask.Result;
}
// Clear diagnostics, in case the project was built before and failed due to errors.
_diagnosticProvider.ClearDiagnostics(_encService.DebuggingSession, _vsProject.VisualStudioWorkspace, EditAndContinueDiagnosticUpdateSource.EmitErrorId, _vsProject.Id, _documentsWithEmitError);
if (!delta.EmitResult.Success)
{
var errors = delta.EmitResult.Diagnostics.Where(d => d.Severity == DiagnosticSeverity.Error);
_documentsWithEmitError = _diagnosticProvider.ReportDiagnostics(
_encService.DebuggingSession,
EditAndContinueDiagnosticUpdateSource.EmitErrorId,
_vsProject.Id,
_projectBeingEmitted.Solution,
errors);
_encService.EditSession.LogEmitProjectDeltaErrors(errors.Select(e => e.Id));
return VSConstants.E_FAIL;
}
_documentsWithEmitError = default(ImmutableArray<DocumentId>);
SetFileUpdates(updater, delta.LineEdits);
updater.SetDeltaIL(delta.IL.Value, (uint)delta.IL.Value.Length);
updater.SetDeltaPdb(new ComStreamWrapper(delta.Pdb.Stream));
updater.SetRemapMethods(delta.Pdb.UpdatedMethods, (uint)delta.Pdb.UpdatedMethods.Length);
updater.SetDeltaMetadata(delta.Metadata.Bytes, (uint)delta.Metadata.Bytes.Length);
_pendingBaseline = delta.EmitResult.Baseline;
#if DEBUG
fixed (byte* deltaMetadataPtr = &delta.Metadata.Bytes[0])
{
var reader = new System.Reflection.Metadata.MetadataReader(deltaMetadataPtr, delta.Metadata.Bytes.Length);
var moduleDef = reader.GetModuleDefinition();
log.DebugWrite("Gen {0}: MVID={1}, BaseId={2}, EncId={3}",
moduleDef.Generation,
reader.GetGuid(moduleDef.Mvid),
reader.GetGuid(moduleDef.BaseGenerationId),
reader.GetGuid(moduleDef.GenerationId));
}
#endif
return VSConstants.S_OK;
}
catch (Exception e) when (FatalError.ReportWithoutCrash(e))
{
return VSConstants.E_FAIL;
}
}