Skip to content

Commit 390c5df

Browse files
authored
Merge pull request #4937 from MDoerner/FixAttributesEncodingIssue
Fixes attributes encoding issue
2 parents f6c0d62 + a63a41c commit 390c5df

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
lines changed

Rubberduck.Core/UI/Command/MenuItems/CommandBars/SerializeProjectsCommandMenuItem.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ protected override void OnExecute(object parameter)
7777
_serializationProvider.SerializeProject(library);
7878
}
7979

80-
#if DEBUG
81-
//This block must be inside a DEBUG block because the Serialize method
82-
//called is conditionally compiled and available only for a DEBUG build.
80+
#if TRACE_COM_SAFE
81+
//This block must be inside a conditional compilation block because the Serialize method
82+
//called is conditionally compiled and available only if the compilation constant TRACE_COM_SAFE is set.
8383
var path = !string.IsNullOrWhiteSpace(_serializationProvider.Target)
8484
? Path.GetDirectoryName(_serializationProvider.Target)
8585
: Path.GetTempPath();

Rubberduck.VBEEditor/ComManagement/ComSafeBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void Dispose()
3232

3333
protected virtual void Dispose(bool disposing)
3434
{
35-
#if DEBUG
35+
#if TRACE_COM_SAFE
3636
if (_disposed)
3737
{
3838
return;
@@ -70,7 +70,7 @@ protected virtual void Dispose(bool disposing)
7070
#endif
7171
}
7272

73-
#if DEBUG
73+
#if TRACE_COM_SAFE
7474
private struct TraceData
7575
{
7676
internal int HashCode { get; set; }

Rubberduck.VBEEditor/ComManagement/IComSafe.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ public interface IComSafe: IDisposable
77
{
88
void Add(ISafeComWrapper comWrapper);
99
bool TryRemove(ISafeComWrapper comWrapper);
10-
#if DEBUG
10+
#if TRACE_COM_SAFE
1111
/// <summary>
12-
/// Available in DEBUG build only. Provide a mechanism for serializing both
12+
/// Available only if the compilation constant TRACE_COM_SAFE is set. Provide a mechanism for serializing both
1313
/// a snapshot of the COM safe at the instant and a historical activity log
1414
/// with a limited stack trace for each entry.
1515
/// </summary>

Rubberduck.VBEEditor/ComManagement/StrongComSafe.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
using System.Collections.Concurrent;
2-
using System.Collections.Generic;
3-
using System.Linq;
42
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
53

4+
#if TRACE_COM_SAFE
5+
using System.Linq;
6+
using System.Collections.Generic;
7+
#endif
8+
69
namespace Rubberduck.VBEditor.ComManagement
710
{
811
public class StrongComSafe: ComSafeBase
@@ -19,14 +22,14 @@ public override void Add(ISafeComWrapper comWrapper)
1922
comWrapper,
2023
key =>
2124
{
22-
#if DEBUG
25+
#if TRACE_COM_SAFE
2326
TraceAdd(comWrapper);
2427
#endif
2528
return 1;
2629
},
2730
(key, value) =>
2831
{
29-
#if DEBUG
32+
#if TRACE_COM_SAFE
3033
TraceUpdate(comWrapper);
3134
#endif
3235
return value;
@@ -42,7 +45,7 @@ public override bool TryRemove(ISafeComWrapper comWrapper)
4245
}
4346

4447
var result = _comWrapperCache.TryRemove(comWrapper, out _);
45-
#if DEBUG
48+
#if TRACE_COM_SAFE
4649
TraceRemove(comWrapper, result);
4750
#endif
4851
return result;
@@ -67,7 +70,7 @@ protected override void Dispose(bool disposing)
6770
_comWrapperCache.Clear();
6871
}
6972

70-
#if DEBUG
73+
#if TRACE_COM_SAFE
7174
protected override IDictionary<int, ISafeComWrapper> GetWrappers()
7275
{
7376
return _comWrapperCache.Keys.ToDictionary(GetComWrapperObjectHashCode);

Rubberduck.VBEEditor/ComManagement/WeakComSafe.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System;
22
using System.Collections.Concurrent;
3-
using System.Collections.Generic;
43
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
54

6-
#if DEBUG
5+
#if TRACE_COM_SAFE
76
using System.Linq;
7+
using System.Collections.Generic;
88
#endif
99

1010
namespace Rubberduck.VBEditor.ComManagement
@@ -22,14 +22,14 @@ public override void Add(ISafeComWrapper comWrapper)
2222
GetComWrapperObjectHashCode(comWrapper),
2323
key =>
2424
{
25-
#if DEBUG
25+
#if TRACE_COM_SAFE
2626
TraceAdd(comWrapper);
2727
#endif
2828
return (DateTime.UtcNow, new WeakReference<ISafeComWrapper>(comWrapper));
2929
},
3030
(key, value) =>
3131
{
32-
#if DEBUG
32+
#if TRACE_COM_SAFE
3333
TraceUpdate(comWrapper);
3434
#endif
3535
return (value.insertTime, new WeakReference<ISafeComWrapper>(comWrapper));
@@ -46,7 +46,7 @@ public override bool TryRemove(ISafeComWrapper comWrapper)
4646
}
4747

4848
var result = _comWrapperCache.TryRemove(GetComWrapperObjectHashCode(comWrapper), out _);
49-
#if DEBUG
49+
#if TRACE_COM_SAFE
5050
TraceRemove(comWrapper, result);
5151
#endif
5252
return result;
@@ -74,7 +74,7 @@ protected override void Dispose(bool disposing)
7474
_comWrapperCache.Clear();
7575
}
7676

77-
#if DEBUG
77+
#if TRACE_COM_SAFE
7878
protected override IDictionary<int, ISafeComWrapper> GetWrappers()
7979
{
8080
var dictionary = new Dictionary<int, ISafeComWrapper>();

Rubberduck.VBEEditor/SourceCodeHandling/SourceFileHandlerComponentSourceCodeHandlerAdapter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.IO;
2+
using System.Text;
23
using Rubberduck.VBEditor.SafeComWrappers;
34
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
45

@@ -31,7 +32,7 @@ public IVBComponent SubstituteCode(IVBComponent module, string newCode)
3132
{
3233
return module;
3334
}
34-
File.WriteAllText(fileName, newCode);
35+
File.WriteAllText(fileName, newCode, Encoding.Default);
3536
return _tempSourceFileHandler.ImportAndCleanUp(module, fileName);
3637
}
3738
}

0 commit comments

Comments
 (0)