diff --git a/.gitignore b/.gitignore
index 3e4e585ce..8bb24a91b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,5 +35,7 @@ _ReSharper*/
*.userprefs
*.swp
*.DotSettings
+#Ignore custom generated files
+LibGit2Sharp/Core/UniqueIdentifier.cs
!Lib/NativeBinaries/*/*.pdb
diff --git a/CustomBuildTasks/CustomBuildTasks.csproj b/CustomBuildTasks/CustomBuildTasks.csproj
new file mode 100644
index 000000000..4afb282bc
--- /dev/null
+++ b/CustomBuildTasks/CustomBuildTasks.csproj
@@ -0,0 +1,42 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {B6138573-A4B9-44E7-83C2-8964CAF51EDA}
+ Library
+ Properties
+ CustomBuildTasks
+ CustomBuildTasks
+ v3.5
+ 512
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CustomBuildTasks/GenerateUniqueIdentifierTask.cs b/CustomBuildTasks/GenerateUniqueIdentifierTask.cs
new file mode 100644
index 000000000..f33c33e8b
--- /dev/null
+++ b/CustomBuildTasks/GenerateUniqueIdentifierTask.cs
@@ -0,0 +1,36 @@
+using System;
+using System.IO;
+using System.Text;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace CustomBuildTasks
+{
+ public class GenerateUniqueIdentifierTask : Task
+ {
+ public override bool Execute()
+ {
+ using (FileStream fs = new FileStream(this.OutputFile, FileMode.Create, FileAccess.Write, FileShare.None))
+ using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
+ {
+ sw.WriteLine("using System;");
+ sw.WriteLine();
+ sw.WriteLine("namespace LibGit2Sharp.Core");
+ sw.WriteLine("{");
+ sw.WriteLine(" internal static class UniqueId");
+ sw.WriteLine(" {");
+ sw.WriteLine(" public const String UniqueIdentifier = \"" + Guid.NewGuid().ToString() + "\";");
+ sw.WriteLine(" }");
+ sw.WriteLine("}");
+ }
+
+ return true;
+ }
+
+ public String OutputFile
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/Lib/CustomBuildTasks/CustomBuildTasks.dll b/Lib/CustomBuildTasks/CustomBuildTasks.dll
new file mode 100644
index 000000000..3cd023b83
Binary files /dev/null and b/Lib/CustomBuildTasks/CustomBuildTasks.dll differ
diff --git a/LibGit2Sharp/Core/FilePathMarshaler.cs b/LibGit2Sharp/Core/FilePathMarshaler.cs
index ec239f354..97f81fa2e 100644
--- a/LibGit2Sharp/Core/FilePathMarshaler.cs
+++ b/LibGit2Sharp/Core/FilePathMarshaler.cs
@@ -11,6 +11,7 @@ namespace LibGit2Sharp.Core
///
/// Use this marshaler for return values, for example:
/// [return: MarshalAs(UnmanagedType.CustomMarshaler,
+ /// MarshalCookie = UniqueId.UniqueIdentifier,
/// MarshalTypeRef = typeof(FilePathNoCleanupMarshaler))]
///
internal class FilePathNoCleanupMarshaler : FilePathMarshaler
@@ -42,6 +43,7 @@ public override void CleanUpNativeData(IntPtr pNativeData)
/// [DllImport(libgit2)]
/// internal static extern int git_index_open(out IndexSafeHandle index,
/// [MarshalAs(UnmanagedType.CustomMarshaler,
+ /// MarshalCookie = UniqueId.UniqueIdentifier,
/// MarshalTypeRef = typeof(FilePathMarshaler))] FilePath indexpath);
///
internal class FilePathMarshaler : ICustomMarshaler
diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs
index cd0078a69..b64c72a4d 100644
--- a/LibGit2Sharp/Core/NativeMethods.cs
+++ b/LibGit2Sharp/Core/NativeMethods.cs
@@ -110,13 +110,13 @@ internal static extern void giterr_set_str(
internal static extern int git_blob_create_fromdisk(
ref GitOid id,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
[DllImport(libgit2)]
internal static extern int git_blob_create_fromworkdir(
ref GitOid id,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath relative_path);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath relative_path);
internal delegate int source_callback(
IntPtr content,
@@ -127,7 +127,7 @@ internal delegate int source_callback(
internal static extern int git_blob_create_fromchunks(
ref GitOid oid,
RepositorySafeHandle repositoryPtr,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath hintpath,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath hintpath,
source_callback fileCallback,
IntPtr data);
@@ -141,7 +141,7 @@ internal static extern int git_blob_create_fromchunks(
internal static extern int git_branch_create(
out ReferenceSafeHandle ref_out,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string branch_name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string branch_name,
GitObjectSafeHandle target, // TODO: GitCommitSafeHandle?
[MarshalAs(UnmanagedType.Bool)] bool force);
@@ -165,7 +165,7 @@ internal static extern int git_branch_foreach(
internal static extern int git_branch_move(
out ReferenceSafeHandle ref_out,
ReferenceSafeHandle reference,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string new_branch_name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string new_branch_name,
[MarshalAs(UnmanagedType.Bool)] bool force);
[DllImport(libgit2)]
@@ -173,14 +173,14 @@ internal static extern int git_branch_remote_name(
byte[] remote_name_out,
UIntPtr buffer_size,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string canonical_branch_name);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string canonical_branch_name);
[DllImport(libgit2)]
internal static extern int git_branch_upstream_name(
byte[] tracking_branch_name_out, // NB: This is more properly a StringBuilder, but it's UTF8
UIntPtr buffer_size,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string referenceName);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string referenceName);
[DllImport(libgit2)]
internal static extern int git_checkout_tree(
@@ -197,8 +197,8 @@ internal static extern int git_checkout_index(
[DllImport(libgit2)]
internal static extern int git_clone(
out RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string origin_url,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath workdir_path,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string origin_url,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath workdir_path,
GitCloneOptions opts);
[DllImport(libgit2)]
@@ -211,21 +211,21 @@ internal static extern int git_clone(
internal static extern int git_commit_create(
out GitOid id,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string updateRef,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string updateRef,
SignatureSafeHandle author,
SignatureSafeHandle committer,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string encoding,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string message,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string encoding,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string message,
GitObjectSafeHandle tree,
int parentCount,
[MarshalAs(UnmanagedType.LPArray)] [In] IntPtr[] parents);
[DllImport(libgit2)]
- [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_commit_message(GitObjectSafeHandle commit);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_commit_message_encoding(GitObjectSafeHandle commit);
[DllImport(libgit2)]
@@ -256,12 +256,12 @@ internal static extern int git_commit_create(
internal static extern int git_config_get_entry(
out GitConfigEntryHandle entry,
ConfigurationSafeHandle cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name);
[DllImport(libgit2)]
internal static extern int git_config_add_file_ondisk(
ConfigurationSafeHandle cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path,
uint level,
bool force);
@@ -277,41 +277,41 @@ internal static extern int git_config_open_level(
[DllImport(libgit2)]
internal static extern int git_config_parse_bool(
[MarshalAs(UnmanagedType.Bool)] out bool value,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string valueToParse);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string valueToParse);
[DllImport(libgit2)]
internal static extern int git_config_parse_int32(
[MarshalAs(UnmanagedType.I4)] out int value,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string valueToParse);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string valueToParse);
[DllImport(libgit2)]
internal static extern int git_config_parse_int64(
[MarshalAs(UnmanagedType.I8)] out long value,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string valueToParse);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string valueToParse);
[DllImport(libgit2)]
internal static extern int git_config_set_bool(
ConfigurationSafeHandle cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
[MarshalAs(UnmanagedType.Bool)] bool value);
[DllImport(libgit2)]
internal static extern int git_config_set_int32(
ConfigurationSafeHandle cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
int value);
[DllImport(libgit2)]
internal static extern int git_config_set_int64(
ConfigurationSafeHandle cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
long value);
[DllImport(libgit2)]
internal static extern int git_config_set_string(
ConfigurationSafeHandle cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string value);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string value);
internal delegate int config_foreach_callback(
IntPtr entry,
@@ -338,8 +338,8 @@ internal delegate int git_cred_acquire_cb(
[DllImport(libgit2)]
internal static extern int git_cred_userpass_plaintext_new(
out IntPtr cred,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof (Utf8Marshaler))] string username,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof (Utf8Marshaler))] string password);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof (Utf8Marshaler))] string username,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof (Utf8Marshaler))] string password);
[DllImport(libgit2)]
internal static extern void git_diff_list_free(IntPtr diff);
@@ -429,7 +429,7 @@ internal static extern int git_diff_foreach(
[DllImport(libgit2)]
internal static extern int git_ignore_add_rule(
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof (Utf8Marshaler))] string rules);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof (Utf8Marshaler))] string rules);
[DllImport(libgit2)]
internal static extern int git_ignore_clear_internal_rules(RepositorySafeHandle repo);
@@ -438,12 +438,12 @@ internal static extern int git_ignore_add_rule(
internal static extern int git_ignore_path_is_ignored(
out int ignored,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
[DllImport(libgit2)]
internal static extern int git_index_add_bypath(
IndexSafeHandle index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
[DllImport(libgit2)]
internal static extern int git_index_add(
@@ -456,7 +456,7 @@ internal static extern int git_index_conflict_get(
out IndexEntrySafeHandle ours,
out IndexEntrySafeHandle theirs,
IndexSafeHandle index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
[DllImport(libgit2)]
internal static extern UIntPtr git_index_entrycount(IndexSafeHandle index);
@@ -468,7 +468,7 @@ internal static extern int git_index_conflict_get(
internal static extern int git_index_find(
out UIntPtr pos,
IndexSafeHandle index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
[DllImport(libgit2)]
internal static extern void git_index_free(IntPtr index);
@@ -479,7 +479,7 @@ internal static extern int git_index_find(
[DllImport(libgit2)]
internal static extern IndexEntrySafeHandle git_index_get_bypath(
IndexSafeHandle index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path,
int stage);
[DllImport(libgit2)]
@@ -488,12 +488,12 @@ internal static extern IndexEntrySafeHandle git_index_get_bypath(
[DllImport(libgit2)]
internal static extern int git_index_open(
out IndexSafeHandle index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath indexpath);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath indexpath);
[DllImport(libgit2)]
internal static extern int git_index_remove_bypath(
IndexSafeHandle index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
[DllImport(libgit2)]
internal static extern int git_index_write(IndexSafeHandle index);
@@ -512,7 +512,7 @@ internal static extern int git_merge_base(
internal static extern int git_message_prettify(
byte[] message_out, // NB: This is more properly a StringBuilder, but it's UTF8
UIntPtr buffer_size,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string message,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string message,
bool strip_comments);
[DllImport(libgit2)]
@@ -521,16 +521,16 @@ internal static extern int git_note_create(
RepositorySafeHandle repo,
SignatureSafeHandle author,
SignatureSafeHandle committer,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
ref GitOid oid,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string note,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string note,
int force);
[DllImport(libgit2)]
internal static extern void git_note_free(IntPtr note);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_note_message(NoteSafeHandle note);
[DllImport(libgit2)]
@@ -540,20 +540,20 @@ internal static extern int git_note_create(
internal static extern int git_note_read(
out NoteSafeHandle note,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
ref GitOid oid);
[DllImport(libgit2)]
internal static extern int git_note_remove(
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
SignatureSafeHandle author,
SignatureSafeHandle committer,
ref GitOid oid);
[DllImport(libgit2)]
internal static extern int git_note_default_ref(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))] out string notes_ref,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))] out string notes_ref,
RepositorySafeHandle repo);
internal delegate int git_note_foreach_cb(
@@ -564,7 +564,7 @@ internal delegate int git_note_foreach_cb(
[DllImport(libgit2)]
internal static extern int git_note_foreach(
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string notes_ref,
git_note_foreach_cb cb,
IntPtr payload);
@@ -604,7 +604,7 @@ internal static extern int git_object_peel(
[DllImport(libgit2)]
internal static extern int git_push_add_refspec(
PushSafeHandle push,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string pushRefSpec);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string pushRefSpec);
[DllImport(libgit2)]
internal static extern int git_push_finish(PushSafeHandle push);
@@ -633,7 +633,7 @@ internal delegate int push_status_foreach_cb(
internal static extern int git_reference_create(
out ReferenceSafeHandle reference,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
ref GitOid oid,
[MarshalAs(UnmanagedType.Bool)] bool force);
@@ -641,8 +641,8 @@ internal static extern int git_reference_create(
internal static extern int git_reference_symbolic_create(
out ReferenceSafeHandle reference,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string target,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string target,
[MarshalAs(UnmanagedType.Bool)] bool force);
[DllImport(libgit2)]
@@ -655,7 +655,7 @@ internal delegate int ref_glob_callback(
[DllImport(libgit2)]
internal static extern int git_reference_foreach_glob(
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string glob,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string glob,
ref_glob_callback callback,
IntPtr payload);
@@ -664,16 +664,16 @@ internal static extern int git_reference_foreach_glob(
[DllImport(libgit2)]
internal static extern int git_reference_is_valid_name(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string refname);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string refname);
[DllImport(libgit2)]
internal static extern int git_reference_lookup(
out ReferenceSafeHandle reference,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_reference_name(ReferenceSafeHandle reference);
[DllImport(libgit2)]
@@ -683,7 +683,7 @@ internal static extern int git_reference_lookup(
internal static extern int git_reference_rename(
out ReferenceSafeHandle ref_out,
ReferenceSafeHandle reference,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string newName,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string newName,
[MarshalAs(UnmanagedType.Bool)] bool force);
[DllImport(libgit2)]
@@ -696,10 +696,10 @@ internal static extern int git_reference_rename(
internal static extern int git_reference_symbolic_set_target(
out ReferenceSafeHandle ref_out,
ReferenceSafeHandle reference,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string target);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string target);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_reference_symbolic_target(ReferenceSafeHandle reference);
[DllImport(libgit2)]
@@ -740,13 +740,13 @@ internal static extern int git_reflog_append(
ReflogSafeHandle reflog,
ref GitOid id,
SignatureSafeHandle committer,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string msg);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string msg);
[DllImport(libgit2)]
internal static extern int git_reflog_write(ReflogSafeHandle reflog);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_reflog_entry_message(SafeHandle entry);
[DllImport(libgit2)]
@@ -754,7 +754,7 @@ internal static extern int git_refspec_rtransform(
byte[] target,
UIntPtr outlen,
GitRefSpecHandle refSpec,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name);
[DllImport(libgit2)]
internal static extern int git_remote_connect(RemoteSafeHandle remote, GitDirection direction);
@@ -763,8 +763,8 @@ internal static extern int git_refspec_rtransform(
internal static extern int git_remote_create(
out RemoteSafeHandle remote,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string url);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string url);
[DllImport(libgit2)]
internal static extern void git_remote_disconnect(RemoteSafeHandle remote);
@@ -783,13 +783,13 @@ internal static extern int git_remote_download(
[DllImport(libgit2)]
internal static extern int git_remote_is_valid_name(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string remote_name);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string remote_name);
[DllImport(libgit2)]
internal static extern int git_remote_load(
out RemoteSafeHandle remote,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name);
internal delegate int git_headlist_cb(ref GitRemoteHead remoteHeadPtr, IntPtr payload);
@@ -797,7 +797,7 @@ internal static extern int git_remote_load(
internal static extern int git_remote_ls(RemoteSafeHandle remote, git_headlist_cb headlist_cb, IntPtr payload);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_remote_name(RemoteSafeHandle remote);
[DllImport(libgit2)]
@@ -810,7 +810,7 @@ internal static extern void git_remote_set_cred_acquire_cb(
IntPtr payload);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_remote_url(RemoteSafeHandle remote);
[DllImport(libgit2)]
@@ -824,7 +824,7 @@ internal static extern int git_remote_set_callbacks(
[DllImport(libgit2)]
internal static extern int git_remote_add_fetch(
RemoteSafeHandle remote,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof (Utf8Marshaler))] string refspec);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof (Utf8Marshaler))] string refspec);
internal delegate void remote_progress_callback(IntPtr str, int len, IntPtr data);
@@ -843,9 +843,9 @@ internal delegate int remote_update_tips_callback(
internal static extern int git_repository_discover(
byte[] repository_path, // NB: This is more properly a StringBuilder, but it's UTF8
UIntPtr size,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath start_path,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath start_path,
[MarshalAs(UnmanagedType.Bool)] bool across_fs,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath ceiling_dirs);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath ceiling_dirs);
internal delegate int git_repository_fetchhead_foreach_cb(
IntPtr remote_name,
@@ -875,7 +875,7 @@ internal static extern int git_repository_fetchhead_foreach(
[DllImport(libgit2)]
internal static extern int git_repository_init(
out RepositorySafeHandle repository,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path,
[MarshalAs(UnmanagedType.Bool)] bool isBare);
[DllImport(libgit2)]
@@ -909,17 +909,17 @@ internal static extern int git_repository_message(
[DllImport(libgit2)]
internal static extern int git_repository_open(
out RepositorySafeHandle repository,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path);
[DllImport(libgit2)]
internal static extern int git_repository_open_ext(
NullRepositorySafeHandle repository,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath path,
RepositoryOpenFlags flags,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath ceilingDirs);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath ceilingDirs);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathNoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathNoCleanupMarshaler))]
internal static extern FilePath git_repository_path(RepositorySafeHandle repository);
[DllImport(libgit2)]
@@ -935,7 +935,7 @@ internal static extern void git_repository_set_index(
[DllImport(libgit2)]
internal static extern int git_repository_set_workdir(
RepositorySafeHandle repository,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath workdir,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath workdir,
bool update_gitlink);
[DllImport(libgit2)]
@@ -943,7 +943,7 @@ internal static extern int git_repository_state(
RepositorySafeHandle repository);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathNoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathNoCleanupMarshaler))]
internal static extern FilePath git_repository_workdir(RepositorySafeHandle repository);
[DllImport(libgit2)]
@@ -956,7 +956,7 @@ internal static extern int git_reset(
internal static extern int git_revparse_single(
out GitObjectSafeHandle obj,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string spec);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string spec);
[DllImport(libgit2)]
internal static extern void git_revwalk_free(IntPtr walker);
@@ -985,8 +985,8 @@ internal static extern int git_revparse_single(
[DllImport(libgit2)]
internal static extern int git_signature_new(
out SignatureSafeHandle signature,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string email,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string email,
long time,
int offset);
@@ -995,7 +995,7 @@ internal static extern int git_stash_save(
out GitOid id,
RepositorySafeHandle repo,
SignatureSafeHandle stasher,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string message,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string message,
StashOptions flags);
internal delegate int git_stash_cb(
@@ -1017,7 +1017,7 @@ internal static extern int git_stash_foreach(
internal static extern int git_status_file(
out FileStatus statusflags,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath filepath);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath filepath);
internal delegate int git_status_cb(
IntPtr path,
@@ -1031,7 +1031,7 @@ internal delegate int git_status_cb(
internal static extern int git_submodule_lookup(
out SubmoduleSafeHandle reference,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name);
internal delegate int submodule_callback(
IntPtr sm,
@@ -1054,12 +1054,12 @@ internal static extern int git_submodule_save(
SubmoduleSafeHandle submodule);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_submodule_path(
SubmoduleSafeHandle submodule);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_submodule_url(
SubmoduleSafeHandle submodule);
@@ -1100,19 +1100,19 @@ internal static extern int git_submodule_status(
internal static extern int git_tag_annotation_create(
out GitOid oid,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
GitObjectSafeHandle target,
SignatureSafeHandle signature,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string message);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string message);
[DllImport(libgit2)]
internal static extern int git_tag_create(
out GitOid oid,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
GitObjectSafeHandle target,
SignatureSafeHandle signature,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string message,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string message,
[MarshalAs(UnmanagedType.Bool)]
bool force);
@@ -1120,7 +1120,7 @@ internal static extern int git_tag_create(
internal static extern int git_tag_create_lightweight(
out GitOid oid,
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name,
GitObjectSafeHandle target,
[MarshalAs(UnmanagedType.Bool)]
bool force);
@@ -1128,14 +1128,14 @@ internal static extern int git_tag_create_lightweight(
[DllImport(libgit2)]
internal static extern int git_tag_delete(
RepositorySafeHandle repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string tagName);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string tagName);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_tag_message(GitObjectSafeHandle tag);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_tag_name(GitObjectSafeHandle tag);
[DllImport(libgit2)]
@@ -1165,7 +1165,7 @@ internal static extern int git_tag_delete(
internal static extern int git_tree_entry_bypath(
out TreeEntrySafeHandle_Owned tree,
GitObjectSafeHandle root,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath treeentry_path);
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath treeentry_path);
[DllImport(libgit2)]
internal static extern void git_tree_entry_free(IntPtr treeEntry);
@@ -1174,7 +1174,7 @@ internal static extern int git_tree_entry_bypath(
internal static extern OidSafeHandle git_tree_entry_id(SafeHandle entry);
[DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
+ [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
internal static extern string git_tree_entry_name(SafeHandle entry);
[DllImport(libgit2)]
@@ -1190,7 +1190,7 @@ internal static extern int git_tree_entry_bypath(
internal static extern int git_treebuilder_insert(
IntPtr entry_out,
TreeBuilderSafeHandle builder,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string treeentry_name,
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string treeentry_name,
ref GitOid id,
uint attributes);
diff --git a/LibGit2Sharp/Core/Utf8Marshaler.cs b/LibGit2Sharp/Core/Utf8Marshaler.cs
index ec78db8fc..79fd2a6c4 100644
--- a/LibGit2Sharp/Core/Utf8Marshaler.cs
+++ b/LibGit2Sharp/Core/Utf8Marshaler.cs
@@ -11,6 +11,7 @@ namespace LibGit2Sharp.Core
///
/// Use this marshaler for return values, for example:
/// [return: MarshalAs(UnmanagedType.CustomMarshaler,
+ /// MarshalCookie = UniqueId.UniqueIdentifier,
/// MarshalTypeRef = typeof(Utf8NoCleanupMarshaler))]
///
internal class Utf8NoCleanupMarshaler : Utf8Marshaler
@@ -42,6 +43,7 @@ public override void CleanUpNativeData(IntPtr pNativeData)
/// [DllImport(libgit2)]
/// internal static extern int git_tag_delete(RepositorySafeHandle repo,
/// [MarshalAs(UnmanagedType.CustomMarshaler,
+ /// MarshalCookie = UniqueId.UniqueIdentifier,
/// MarshalTypeRef = typeof(Utf8Marshaler))] String tagName);
///
internal class Utf8Marshaler : ICustomMarshaler
diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj
index 65a9f90ee..5e1442721 100644
--- a/LibGit2Sharp/LibGit2Sharp.csproj
+++ b/LibGit2Sharp/LibGit2Sharp.csproj
@@ -250,6 +250,7 @@
+
@@ -261,6 +262,7 @@
+
diff --git a/LibGit2Sharp/UniqueIdentifier.targets b/LibGit2Sharp/UniqueIdentifier.targets
new file mode 100644
index 000000000..ef65ddf11
--- /dev/null
+++ b/LibGit2Sharp/UniqueIdentifier.targets
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+ Core\UniqueIdentifier.cs
+ $(CoreCompileDependsOn);GenerateUniqueIdentifierCs
+ $(CoreCleanDependsOn);CleanUniqueIdentifierCs
+
+
+
+
+
+
+
+
+
+
+
+