diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 0e76e8af5f..c901bc12d0 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -11,11 +11,11 @@ - false + true - false + true diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs index bc994a00ce..1ceffe6044 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs @@ -225,7 +225,7 @@ private void ApplyRelocations(IModule module, PEReader reader, int dataVA, byte[ PEMemoryBlock relocations = reader.GetSectionData(".reloc"); if (relocations.Length > 0) { - ulong baseDelta = module.ImageBase - reader.PEHeaders.PEHeader.ImageBase; + ulong baseDelta = unchecked(module.ImageBase - reader.PEHeaders.PEHeader.ImageBase); #if TRACE_VERBOSE Trace.TraceInformation("ApplyRelocations: dataVA {0:X8} dataCB {1} baseDelta: {2:X16}", dataVA, data.Length, baseDelta); #endif @@ -267,7 +267,7 @@ private void ApplyRelocations(IModule module, PEReader reader, int dataVA, byte[ if ((offset + sizeof(uint)) <= data.Length) { uint value = BitConverter.ToUInt32(data, offset); - value += (uint)baseDelta; + unchecked { value += (uint)baseDelta; } byte[] source = BitConverter.GetBytes(value); Array.Copy(source, 0, data, offset, source.Length); } diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs index b69ac6312b..bd437e85e7 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs @@ -494,7 +494,7 @@ internal bool Read(ulong address, byte[] buffer, int bufferSize, out int bytesRe return _memoryService.ReadMemory(address, buffer, bufferSize, out bytesRead); } - if (!_cacheValid || (address < _startCache) || (address > (_startCache + (ulong)(_cacheSize - bufferSize)))) + if (!_cacheValid || (address < _startCache) || (address > (_startCache + (ulong)_cacheSize - (ulong)bufferSize))) { _cacheValid = false; _startCache = address; diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleServiceFromDataReader.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleServiceFromDataReader.cs index 60f6dc7138..0ad0019c47 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleServiceFromDataReader.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleServiceFromDataReader.cs @@ -47,9 +47,9 @@ public ModuleFromDataReader(ModuleServiceFromDataReader moduleService, int modul public override ulong ImageSize => _imageSize; - public override uint? IndexFileSize => _moduleInfo.IndexTimeStamp == InvalidTimeStamp ? null : (uint)_moduleInfo.IndexFileSize; + public override uint? IndexFileSize => _moduleInfo.IndexTimeStamp == InvalidTimeStamp ? null : unchecked((uint)_moduleInfo.IndexFileSize); - public override uint? IndexTimeStamp => _moduleInfo.IndexTimeStamp == InvalidTimeStamp ? null : (uint)_moduleInfo.IndexTimeStamp; + public override uint? IndexTimeStamp => _moduleInfo.IndexTimeStamp == InvalidTimeStamp ? null : unchecked((uint)_moduleInfo.IndexTimeStamp); public override ImmutableArray BuildId { diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/Utilities.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/Utilities.cs index 0876574724..6eba2ce406 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/Utilities.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/Utilities.cs @@ -127,6 +127,7 @@ public static object InvokeConstructor(Type type, IServiceProvider provider, boo } catch (TargetInvocationException ex) { + Trace.TraceError(ex.ToString()); throw ex.InnerException; } } @@ -148,6 +149,7 @@ public static object Invoke(MethodBase method, object instance, IServiceProvider } catch (TargetInvocationException ex) { + Trace.TraceError(ex.ToString()); throw ex.InnerException; } }