Skip to content

Commit c3822ed

Browse files
Merge pull request #40 from codingadventures/SentryIntegration
Massive refactoring #39
2 parents 7544af5 + ac218a2 commit c3822ed

File tree

221 files changed

+1841
-4099
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+1841
-4099
lines changed
File renamed without changes.
Binary file not shown.

Src/Build/BridgeVs.Build.csproj renamed to Src/BridgeVs.Build/BridgeVs.Build.csproj

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</PropertyGroup>
2222
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Test|AnyCPU'">
2323
<OutputPath>bin\Test\</OutputPath>
24-
<DefineConstants>TRACE;DEBUG</DefineConstants>
24+
<DefineConstants>TRACE;DEBUG;TEST</DefineConstants>
2525
<DebugType>full</DebugType>
2626
<DebugSymbols>true</DebugSymbols>
2727
</PropertyGroup>
@@ -31,58 +31,38 @@
3131
<PlatformTarget>AnyCPU</PlatformTarget>
3232
<Optimize>true</Optimize>
3333
</PropertyGroup>
34-
<PropertyGroup>
35-
<SignAssembly>false</SignAssembly>
36-
</PropertyGroup>
37-
<PropertyGroup>
38-
<AssemblyOriginatorKeyFile>..\LinqBridgeVsExtension\Key.snk</AssemblyOriginatorKeyFile>
39-
</PropertyGroup>
4034
<ItemGroup>
35+
<Compile Include="Dependency\Crawler.cs" />
36+
<Compile Include="Dependency\ProjectDependency.cs" />
37+
<Compile Include="SInjection.cs" />
4138
<Compile Include="Tasks\CleanBuildTask.cs" />
4239
<Compile Include="Tasks\MapperBuildTask.cs" />
4340
<Compile Include="Properties\AssemblyInfo.cs" />
4441
<Compile Include="Tasks\SInjectionBuildTask.cs" />
4542
<Compile Include="TypeMapper\VisualizerAttributeInjector.cs" />
4643
<Compile Include="Util\EnumerableExtension.cs" />
44+
<Compile Include="Util\ReflectionUtils.cs" />
45+
<Compile Include="Util\TypeReferenceExt.cs" />
4746
<Compile Include="Util\VisualizerAssemblyNameFormat.cs" />
48-
<Compile Include="VisualStudioOptions.cs" />
4947
</ItemGroup>
5048
<ItemGroup>
5149
<ProjectReference Include="..\BridgeVs.Locations\BridgeVs.Locations.csproj">
5250
<Project>{bc10f93a-5da2-44f8-ae5e-5603cb46b548}</Project>
5351
<Name>BridgeVs.Locations</Name>
5452
</ProjectReference>
55-
<ProjectReference Include="..\Logging\BridgeVs.Logging.csproj">
53+
<ProjectReference Include="..\BridgeVs.DynamicVisualizers\BridgeVs.DynamicVisualizers.csproj">
54+
<Project>{b84fbd50-0b10-4c25-8430-680fc6fc3fea}</Project>
55+
<Name>BridgeVs.DynamicVisualizers</Name>
56+
</ProjectReference>
57+
<ProjectReference Include="..\BridgeVs.Logging\BridgeVs.Logging.csproj">
5658
<Project>{0b546762-c8c0-45c6-bc42-c5d91d510351}</Project>
5759
<Name>BridgeVs.Logging</Name>
5860
</ProjectReference>
59-
<ProjectReference Include="..\SInject\BridgeVs.SInject.csproj">
60-
<Project>{cd851c2d-8b24-4d72-b2a1-149f7d27c2f1}</Project>
61-
<Name>BridgeVs.SInject</Name>
62-
</ProjectReference>
63-
<ProjectReference Include="..\DynamicVisualizer.V11\BridgeVs.DynamicVisualizer.V11.csproj">
64-
<Project>{c6798d16-89f5-4bff-8b62-2be6d4bbc192}</Project>
65-
<Name>BridgeVs.DynamicVisualizer.V11</Name>
66-
<Private>False</Private>
67-
</ProjectReference>
68-
<ProjectReference Include="..\DynamicVisualizer.V12\BridgeVs.DynamicVisualizer.V12.csproj">
69-
<Project>{835064f0-3c4f-4646-b17a-632c192cce3b}</Project>
70-
<Name>BridgeVs.DynamicVisualizer.V12</Name>
71-
<Private>False</Private>
72-
</ProjectReference>
73-
<ProjectReference Include="..\DynamicVisualizer.V14\BridgeVs.DynamicVisualizer.V14.csproj">
74-
<Project>{0beb30c9-243b-4192-8633-423b9322c587}</Project>
75-
<Name>BridgeVs.DynamicVisualizer.V14</Name>
76-
<Private>False</Private>
77-
</ProjectReference>
78-
<ProjectReference Include="..\DynamicVisualizer.V15\BridgeVs.DynamicVisualizer.V15.csproj">
79-
<Project>{6278c369-9593-4e93-a725-010717e7fc10}</Project>
80-
<Name>BridgeVs.DynamicVisualizer.V15</Name>
81-
<Private>False</Private>
82-
</ProjectReference>
8361
</ItemGroup>
8462
<ItemGroup>
63+
<Reference Include="Microsoft.Build" />
8564
<Reference Include="Microsoft.Build.Framework" />
65+
<Reference Include="Microsoft.CSharp" />
8666
<Reference Include="Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
8767
<HintPath>..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.dll</HintPath>
8868
</Reference>
@@ -93,11 +73,22 @@
9373
<SpecificVersion>False</SpecificVersion>
9474
<HintPath>..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
9575
</Reference>
76+
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
77+
<HintPath>..\packages\Newtonsoft.Json.11.0.1\lib\net40\Newtonsoft.Json.dll</HintPath>
78+
</Reference>
79+
<Reference Include="SharpRaven, Version=2.3.2.0, Culture=neutral, processorArchitecture=MSIL">
80+
<HintPath>..\packages\SharpRaven.2.3.2\lib\net40\SharpRaven.dll</HintPath>
81+
</Reference>
9682
<Reference Include="System" />
83+
<Reference Include="System.Configuration" />
9784
<Reference Include="System.Core" />
85+
<Reference Include="System.XML" />
86+
<Reference Include="System.Xml.Linq" />
9887
</ItemGroup>
9988
<ItemGroup>
100-
<None Include="app.config" />
89+
<None Include="app.config">
90+
<SubType>Designer</SubType>
91+
</None>
10192
<None Include="packages.config">
10293
<SubType>Designer</SubType>
10394
</None>

Src/VsExtension.Helper/Dependency/Crawler.cs renamed to Src/BridgeVs.Build/Dependency/Crawler.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
using BridgeVs.Logging;
3434
using Microsoft.Build.Evaluation;
3535

36-
namespace BridgeVs.Helper.Dependency
36+
namespace BridgeVs.Build.Dependency
3737
{
38-
public class Crawler
38+
internal class Crawler
3939
{
4040
private const string MsbuildNamespace = "http://schemas.microsoft.com/developer/msbuild/2003";
4141
/// <summary>
@@ -44,12 +44,12 @@ public class Crawler
4444
/// <param name="csvbProjectName">Name of the CS or VB project.</param>
4545
/// <param name="solutionName">Name of the solution.</param>
4646
/// <returns></returns>
47-
public static IEnumerable<Dependency> FindDependencies(string csvbProjectName, string solutionName)
47+
internal static IEnumerable<ProjectDependency> FindDependencies(string csvbProjectName, string solutionName)
4848
{
4949
if (string.IsNullOrEmpty(csvbProjectName))
5050
{
51-
Log.Write("BridgeVs.Helper.Dependency.Crawler: csvbProjectName is null or empty");
52-
return Enumerable.Empty<Dependency>();
51+
Log.Write("BridgeVs.VsPackage.Helper.Dependency.Crawler: csvbProjectName is null or empty");
52+
return Enumerable.Empty<ProjectDependency>();
5353
}
5454

5555
XmlNamespaceManager namespaceManager = new XmlNamespaceManager(new NameTable());
@@ -73,7 +73,7 @@ where proj.ItemType.Equals("ProjectReference")
7373
let assemblyName = referenceProjectXDocument.XPathSelectElement("/aw:Project/aw:PropertyGroup/aw:AssemblyName", namespaceManager)?.Value
7474
let outputType = referenceProjectXDocument.XPathSelectElement("/aw:Project/aw:PropertyGroup/aw:OutputType", namespaceManager)?.Value
7575
let outputPath = referenceProjectXDocument.XPathSelectElement("/aw:Project/aw:PropertyGroup/aw:OutputPath", namespaceManager)?.Value
76-
select new Dependency
76+
select new ProjectDependency
7777
{
7878
DependencyType =
7979
proj.ItemType.Equals("Reference") ? DependencyType.AssemblyReference : DependencyType.ProjectReference,
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#region License
2-
// Copyright (c) 2013 Coding Adventures
2+
// Copyright (c) 2013 - 2018 Coding Adventures
33
//
44
// Permission is hereby granted, free of charge, to any person
55
// obtaining a copy of this software and associated documentation
@@ -23,31 +23,24 @@
2323
// OTHER DEALINGS IN THE SOFTWARE.
2424
#endregion
2525

26-
using System;
27-
28-
namespace BridgeVs.Helper.Dependency
26+
namespace BridgeVs.Build.Dependency
2927
{
30-
[Serializable]
31-
public enum DependencyType
32-
{
33-
ProjectReference,
34-
AssemblyReference
35-
}
36-
37-
[Serializable]
38-
public class Dependency
28+
internal class ProjectDependency
3929
{
4030
public DependencyType DependencyType { get; set; }
41-
4231
public string AssemblyName { get; set; }
43-
4432
public string AssemblyPath { get; set; }
45-
4633
public string SolutionName { get; set; }
4734

4835
public override string ToString()
4936
{
5037
return $"{DependencyType} {AssemblyName} {AssemblyPath}";
5138
}
5239
}
53-
}
40+
41+
internal enum DependencyType
42+
{
43+
AssemblyReference,
44+
ProjectReference
45+
}
46+
}

Src/Build/Properties/AssemblyInfo.cs renamed to Src/BridgeVs.Build/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@
6060
// You can specify all the values or you can default the Build and Revision Numbers
6161
// by using the '*' as shown below:
6262
// [assembly: AssemblyVersion("1.0.*")]
63-
[assembly: InternalsVisibleTo("BridgeVs.Build.IntegrationTest")]
63+
#if TEST
64+
[assembly: InternalsVisibleTo("BridgeVs.Build.Test")]
65+
#endif
6466

65-
[assembly: AssemblyVersion("1.0.*")]
67+
[assembly: AssemblyVersion("1.4.*")]
6668
[assembly: AssemblyFileVersion("1.0.0.0")]

Src/SInject/SInjection.cs renamed to Src/BridgeVs.Build/SInjection.cs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
using System.Linq;
3131
using System.Reflection;
3232
using System.Threading;
33+
using BridgeVs.Build.Util;
3334
using BridgeVs.Logging;
3435
using Mono.Cecil;
3536
using Mono.Cecil.Pdb;
36-
using BridgeVs.SInject.Reflection;
3737

38-
namespace BridgeVs.SInject
38+
namespace BridgeVs.Build
3939
{
4040
/// <summary>
4141
/// Type of serialization to enable
@@ -68,19 +68,17 @@ public enum PatchMode
6868
Release
6969
}
7070

71-
7271
/// <summary>
7372
/// This class inject the Serializable Attribute to all public class types in a given assembly, and adds
7473
/// default deserialization constructor for those type which implement ISerializable interface
7574
/// </summary>
76-
public class SInjection
75+
internal class SInjection
7776
{
7877
#region [ Private Properties ]
7978
private readonly string _assemblyLocation;
8079
private readonly PatchMode _mode;
8180
private readonly AssemblyDefinition _assemblyDefinition;
82-
private static readonly Func<string, bool> IsSystemAssembly =
83-
name => name.Contains("Microsoft") || name.Contains("System") || name.Contains("mscorlib");
81+
private static readonly Func<string, bool> IsSystemAssembly = name => name.Contains("Microsoft") || name.Contains("System") || name.Contains("mscorlib");
8482

8583
private const string Marker = "SInjected";
8684
private readonly string _snkCertificatePath;
@@ -164,8 +162,8 @@ public bool Patch(SerializationTypes types)
164162
AddSinjectionAttribute();
165163

166164
bool success = WriteAssembly();
167-
Log.Write(success
168-
? "Assembly {0} has been correctly Injected"
165+
Log.Write(success
166+
? "Assembly {0} has been correctly Injected"
169167
: "Assembly {0} was not correctly Injected",
170168
_assemblyDefinition.FullName);
171169
return success;
@@ -290,19 +288,13 @@ private ReaderParameters GetReaderParameters()
290288
ReaderParameters readerParameters = new ReaderParameters
291289
{
292290
AssemblyResolver = assemblyResolver,
293-
#if DEBUG
291+
#if TEST
294292
InMemory = true,
295293
#endif
296294
ReadingMode = ReadingMode.Immediate
297295
};
298-
299-
if (!File.Exists(PdbName))
300-
return readerParameters;
301-
302-
PdbReaderProvider symbolReaderProvider = new PdbReaderProvider();
303-
readerParameters.SymbolReaderProvider = symbolReaderProvider;
304-
305296
return readerParameters;
297+
//disables reading the symbols...
306298
}
307299

308300
private WriterParameters GetWriterParameters()

Src/Build/Tasks/CleanBuildTask.cs renamed to Src/BridgeVs.Build/Tasks/CleanBuildTask.cs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
using System.IO;
2727
using BridgeVs.Build.Util;
28+
using BridgeVs.Locations;
29+
using BridgeVs.Logging;
2830
using Microsoft.Build.Framework;
2931

3032
namespace BridgeVs.Build.Tasks
@@ -33,18 +35,29 @@ public class CleanBuildTask : ITask
3335
{
3436
public bool Execute()
3537
{
36-
string visualizerAssemblyName = VisualizerAssemblyNameFormat.GetTargetVisualizerAssemblyName(VisualStudioVer, Assembly);
37-
string targetInstallationPath = VisualStudioOptions.GetVisualizerDestinationFolder(VisualStudioVer);
38+
try
39+
{
40+
string visualizerAssemblyName = VisualizerAssemblyNameFormat.GetTargetVisualizerAssemblyName(VisualStudioVer, Assembly);
41+
string targetInstallationPath = VisualStudioOptions.GetVisualizerDestinationFolder(VisualStudioVer);
3842

39-
string visualizerFullPath = Path.Combine(targetInstallationPath, visualizerAssemblyName);
43+
string visualizerFullPath = Path.Combine(targetInstallationPath, visualizerAssemblyName);
4044

41-
if (File.Exists(visualizerFullPath))
42-
File.Delete(visualizerFullPath);
45+
if (File.Exists(visualizerFullPath))
46+
File.Delete(visualizerFullPath);
4347

44-
//check if pdb also exists and delete it
45-
string visualizerPdbFullPath = visualizerFullPath.Replace(".dll",".pdb");
46-
if (File.Exists(visualizerPdbFullPath))
47-
File.Delete(visualizerPdbFullPath);
48+
//check if pdb also exists and delete it
49+
string visualizerPdbFullPath = Path.ChangeExtension(visualizerFullPath , "pdb");
50+
51+
if (File.Exists(visualizerPdbFullPath))
52+
File.Delete(visualizerPdbFullPath);
53+
}
54+
catch (System.Exception exception)
55+
{
56+
if (CommonRegistryConfigurations.IsErrorTrackingEnabled(VisualStudioVer))
57+
RavenWrapper.Instance.Capture(exception, message: "Error during project cleaning", vsVersion: VisualStudioVer);
58+
59+
return false;
60+
}
4861

4962
return true;
5063
}

0 commit comments

Comments
 (0)