Linux (Ubuntu) libFLAC support.

Linux (Ubuntu) libFLAC support.

--- AudioWorks/Extensions/AudioWorks.Extensions.Flac/SafeNativeMethods.cs
+++ AudioWorks/Extensions/AudioWorks.Extensions.Flac/SafeNativeMethods.cs
@@ -14,17 +14,22 @@
     static class SafeNativeMethods
     {
         const string _winFlacLibrary = "libFLAC.dll";
+        const string _linuxFlacLibrary = "libFLAC.so.8";

         static SafeNativeMethods()
         {
-            // Select an architecture-appropriate directory by prefixing the PATH variable:
-            var newPath = new StringBuilder(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath));
-            newPath.Append(Path.DirectorySeparatorChar);
-            newPath.Append(Environment.Is64BitProcess ? "x64" : "x86");
-            newPath.Append(Path.PathSeparator);
-            newPath.Append(Environment.GetEnvironmentVariable("PATH"));
-
-            Environment.SetEnvironmentVariable("PATH", newPath.ToString());
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+            {
+                // Select an architecture-appropriate directory by prefixing the PATH variable:
+                var newPath = new StringBuilder(
+                    Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath));
+                newPath.Append(Path.DirectorySeparatorChar);
+                newPath.Append(Environment.Is64BitProcess ? "x64" : "x86");
+                newPath.Append(Path.PathSeparator);
+                newPath.Append(Environment.GetEnvironmentVariable("PATH"));
+
+                Environment.SetEnvironmentVariable("PATH", newPath.ToString());
+            }
         }

         [NotNull]
@@ -32,6 +37,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 return WinStreamDecoderNew();
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                return LinuxStreamDecoderNew();

             throw new NotImplementedException();
         }
@@ -64,6 +71,21 @@
                     IntPtr.Zero);
                 return;
             }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxStreamDecoderInitStream(
+                    handle,
+                    readCallback,
+                    seekCallback,
+                    tellCallback,
+                    lengthCallback,
+                    eofCallback,
+                    writeCallback,
+                    metadataCallback,
+                    errorCallback,
+                    IntPtr.Zero);
+                return;
+            }

             throw new NotImplementedException();
         }
@@ -77,6 +99,11 @@
                 WinStreamDecoderSetMetadataRespond(handle, metadataType);
                 return;
             }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxStreamDecoderSetMetadataRespond(handle, metadataType);
+                return;
+            }

             throw new NotImplementedException();
         }
@@ -86,6 +113,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 return WinStreamDecoderProcessUntilEndOfMetadata(handle);
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                return LinuxStreamDecoderProcessUntilEndOfMetadata(handle);

             throw new NotImplementedException();
         }
@@ -95,6 +124,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 return WinStreamDecoderGetState(handle);
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                return LinuxStreamDecoderGetState(handle);

             throw new NotImplementedException();
         }
@@ -108,6 +139,11 @@
                 WinStreamDecoderFinish(handle);
                 return;
             }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxStreamDecoderFinish(handle);
+                return;
+            }

             throw new NotImplementedException();
         }
@@ -118,6 +154,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 WinStreamDecoderDelete(handle);
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                LinuxStreamDecoderDelete(handle);
         }

         [NotNull]
@@ -126,6 +164,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 return WinMetadataObjectNew(metadataType);
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                return LinuxMetadataObjectNew(metadataType);

             throw new NotImplementedException();
         }
@@ -140,6 +180,11 @@
                 WinMetadataObjectVorbisCommentEntryFromNameValuePair(out vorbisComment, key, value);
                 return;
             }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxMetadataObjectVorbisCommentEntryFromNameValuePair(out vorbisComment, key, value);
+                return;
+            }

             throw new NotImplementedException();
         }
@@ -154,6 +199,11 @@
                 WinMetadataObjectVorbisCommentAppendComment(handle, vorbisComment, copy);
                 return;
             }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxMetadataObjectVorbisCommentAppendComment(handle, vorbisComment, copy);
+                return;
+            }

             throw new NotImplementedException();
         }
@@ -164,6 +214,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 WinMetadataObjectDelete(handle);
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                LinuxMetadataObjectDelete(handle);
         }

         [NotNull]
@@ -171,6 +223,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 return WinMetadataChainNew();
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                return LinuxMetadataChainNew();

             throw new NotImplementedException();
         }
@@ -184,6 +238,11 @@
                 WinMetadataChainReadWithCallbacks(handle, IntPtr.Zero, callbacks);
                 return;
             }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxMetadataChainReadWithCallbacks(handle, IntPtr.Zero, callbacks);
+                return;
+            }

             throw new NotImplementedException();
         }
@@ -194,6 +253,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 return WinMetadataChainCheckIfTempFileNeeded(handle, usePadding);
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                return LinuxMetadataChainCheckIfTempFileNeeded(handle, usePadding);

             throw new NotImplementedException();
         }
@@ -206,6 +267,11 @@
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
             {
                 WinMetadataChainWriteWithCallbacks(handle, usePadding, IntPtr.Zero, callbacks);
+                return;
+            }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxMetadataChainWriteWithCallbacks(handle, usePadding, IntPtr.Zero, callbacks);
                 return;
             }

@@ -229,6 +295,17 @@
                     tempCallbacks);
                 return;
             }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxMetadataChainWriteWithCallbacksAndTempFile(
+                    handle,
+                    usePadding,
+                    IntPtr.Zero,
+                    callbacks,
+                    IntPtr.Zero,
+                    tempCallbacks);
+                return;
+            }

             throw new NotImplementedException();
         }
@@ -239,6 +316,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 WinMetadataChainDelete(handle);
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                LinuxMetadataChainDelete(handle);
         }

         [NotNull]
@@ -246,6 +325,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 return WinMetadataIteratorNew();
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                return LinuxMetadataIteratorNew();

             throw new NotImplementedException();
         }
@@ -257,6 +338,11 @@
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
             {
                 WinMetadataIteratorInit(handle, chainHandle);
+                return;
+            }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxMetadataIteratorInit(handle, chainHandle);
                 return;
             }

@@ -268,6 +354,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 return WinMetadataIteratorNext(handle);
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                return LinuxMetadataIteratorNext(handle);

             throw new NotImplementedException();
         }
@@ -277,6 +365,8 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 return WinMetadataIteratorGetBlock(handle);
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                return LinuxMetadataIteratorGetBlock(handle);

             throw new NotImplementedException();
         }
@@ -290,6 +380,11 @@
                 WinMetadataIteratorInsertBlockAfter(handle, metadataHandle);
                 return;
             }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxMetadataIteratorInsertBlockAfter(handle, metadataHandle);
+                return;
+            }

             throw new NotImplementedException();
         }
@@ -301,6 +396,11 @@
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
             {
                 WinMetadataIteratorDeleteBlock(handle, replaceWithPadding);
+                return;
+            }
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+                LinuxMetadataIteratorDeleteBlock(handle, replaceWithPadding);
                 return;
             }

@@ -313,13 +413,22 @@
         {
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 WinMetadataIteratorDelete(handle);
-        }
-
-        [NotNull]
-        [DllImport(_winFlacLibrary, EntryPoint = "FLAC__stream_decoder_new", CallingConvention = CallingConvention.Cdecl)]
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+                LinuxMetadataIteratorDelete(handle);
+        }
+
+        [NotNull]
+        [DllImport(_winFlacLibrary, EntryPoint = "FLAC__stream_decoder_new",
+            CallingConvention = CallingConvention.Cdecl)]
         static extern NativeStreamDecoderHandle WinStreamDecoderNew();

-        [DllImport(_winFlacLibrary, EntryPoint = "FLAC__stream_decoder_init_stream", CallingConvention = CallingConvention.Cdecl)]
+        [NotNull]
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__stream_decoder_new",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern NativeStreamDecoderHandle LinuxStreamDecoderNew();
+
+        [DllImport(_winFlacLibrary, EntryPoint = "FLAC__stream_decoder_init_stream",
+            CallingConvention = CallingConvention.Cdecl)]
         static extern int WinStreamDecoderInitStream(
             [NotNull] NativeStreamDecoderHandle handle,
             [NotNull] NativeCallbacks.StreamDecoderReadCallback readCallback,
@@ -332,6 +441,20 @@
             [NotNull] NativeCallbacks.StreamDecoderErrorCallback errorCallback,
             IntPtr userData);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__stream_decoder_init_stream",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern int LinuxStreamDecoderInitStream(
+            [NotNull] NativeStreamDecoderHandle handle,
+            [NotNull] NativeCallbacks.StreamDecoderReadCallback readCallback,
+            [NotNull] NativeCallbacks.StreamDecoderSeekCallback seekCallback,
+            [NotNull] NativeCallbacks.StreamDecoderTellCallback tellCallback,
+            [NotNull] NativeCallbacks.StreamDecoderLengthCallback lengthCallback,
+            [NotNull] NativeCallbacks.StreamDecoderEofCallback eofCallback,
+            [NotNull] NativeCallbacks.StreamDecoderWriteCallback writeCallback,
+            [NotNull] NativeCallbacks.StreamDecoderMetadataCallback metadataCallback,
+            [NotNull] NativeCallbacks.StreamDecoderErrorCallback errorCallback,
+            IntPtr userData);
+
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__stream_decoder_set_metadata_respond",
             CallingConvention = CallingConvention.Cdecl)]
         [return: MarshalAs(UnmanagedType.Bool)]
@@ -339,33 +462,69 @@
             NativeStreamDecoderHandle handle,
             MetadataType metadataType);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__stream_decoder_set_metadata_respond",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxStreamDecoderSetMetadataRespond(
+            NativeStreamDecoderHandle handle,
+            MetadataType metadataType);
+
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__stream_decoder_process_until_end_of_metadata",
             CallingConvention = CallingConvention.Cdecl)]
         [return: MarshalAs(UnmanagedType.Bool)]
         static extern bool WinStreamDecoderProcessUntilEndOfMetadata(
             [NotNull] NativeStreamDecoderHandle handle);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__stream_decoder_process_until_end_of_metadata",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxStreamDecoderProcessUntilEndOfMetadata(
+            [NotNull] NativeStreamDecoderHandle handle);
+
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__stream_decoder_get_state",
             CallingConvention = CallingConvention.Cdecl)]
         static extern DecoderState WinStreamDecoderGetState(
             [NotNull] NativeStreamDecoderHandle handle);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__stream_decoder_get_state",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern DecoderState LinuxStreamDecoderGetState(
+            [NotNull] NativeStreamDecoderHandle handle);
+
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__stream_decoder_finish",
             CallingConvention = CallingConvention.Cdecl)]
         [return: MarshalAs(UnmanagedType.Bool)]
         static extern bool WinStreamDecoderFinish(
             [NotNull] NativeStreamDecoderHandle handle);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__stream_decoder_finish",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxStreamDecoderFinish(
+            [NotNull] NativeStreamDecoderHandle handle);
+
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__stream_decoder_delete",
             CallingConvention = CallingConvention.Cdecl)]
         static extern void WinStreamDecoderDelete(
             IntPtr handle);

+        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__stream_decoder_delete",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern void LinuxStreamDecoderDelete(
+            IntPtr handle);
+
         [NotNull]
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_object_new",
             CallingConvention = CallingConvention.Cdecl)]
         static extern NativeMetadataBlockHandle WinMetadataObjectNew(
+            MetadataType blockType);
+
+        [NotNull]
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_object_new",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern NativeMetadataBlockHandle LinuxMetadataObjectNew(
             MetadataType blockType);

         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair",
@@ -376,6 +535,14 @@
             [NotNull] byte[] key,
             [NotNull] byte[] value);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxMetadataObjectVorbisCommentEntryFromNameValuePair(
+            out VorbisCommentEntry vorbisComment,
+            [NotNull] byte[] key,
+            [NotNull] byte[] value);
+
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_object_vorbiscomment_append_comment",
             CallingConvention = CallingConvention.Cdecl)]
         [return: MarshalAs(UnmanagedType.Bool)]
@@ -384,16 +551,35 @@
             VorbisCommentEntry vorbisComment,
             [MarshalAs(UnmanagedType.Bool)] bool copy);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_object_vorbiscomment_append_comment",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxMetadataObjectVorbisCommentAppendComment(
+            [NotNull] NativeMetadataBlockHandle handle,
+            VorbisCommentEntry vorbisComment,
+            [MarshalAs(UnmanagedType.Bool)] bool copy);
+
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_object_delete",
             CallingConvention = CallingConvention.Cdecl)]
         static extern void WinMetadataObjectDelete(
             IntPtr handle);

+        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_object_delete",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern void LinuxMetadataObjectDelete(
+            IntPtr handle);
+
         [NotNull]
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_chain_new",
             CallingConvention = CallingConvention.Cdecl)]
         static extern NativeMetadataChainHandle WinMetadataChainNew();
+
+        [NotNull]
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_chain_new",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern NativeMetadataChainHandle LinuxMetadataChainNew();

         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_chain_read_with_callbacks",
             CallingConvention = CallingConvention.Cdecl)]
@@ -403,6 +589,14 @@
             IntPtr ioHandle,
             IoCallbacks callbacks);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_chain_read_with_callbacks",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxMetadataChainReadWithCallbacks(
+            [NotNull] NativeMetadataChainHandle handle,
+            IntPtr ioHandle,
+            IoCallbacks callbacks);
+
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_chain_check_if_tempfile_needed",
             CallingConvention = CallingConvention.Cdecl)]
         [return: MarshalAs(UnmanagedType.Bool)]
@@ -410,10 +604,26 @@
             [NotNull] NativeMetadataChainHandle handle,
             [MarshalAs(UnmanagedType.Bool)] bool usePadding);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_chain_check_if_tempfile_needed",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxMetadataChainCheckIfTempFileNeeded(
+            [NotNull] NativeMetadataChainHandle handle,
+            [MarshalAs(UnmanagedType.Bool)] bool usePadding);
+
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_chain_write_with_callbacks",
             CallingConvention = CallingConvention.Cdecl)]
         [return: MarshalAs(UnmanagedType.Bool)]
         static extern bool WinMetadataChainWriteWithCallbacks(
+            [NotNull] NativeMetadataChainHandle handle,
+            [MarshalAs(UnmanagedType.Bool)] bool usePadding,
+            IntPtr ioHandle,
+            IoCallbacks callbacks);
+
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_chain_write_with_callbacks",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxMetadataChainWriteWithCallbacks(
             [NotNull] NativeMetadataChainHandle handle,
             [MarshalAs(UnmanagedType.Bool)] bool usePadding,
             IntPtr ioHandle,
@@ -430,20 +640,48 @@
             IntPtr tempIoHandle,
             IoCallbacks tempCallbacks);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_chain_write_with_callbacks_and_tempfile",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxMetadataChainWriteWithCallbacksAndTempFile(
+            [NotNull] NativeMetadataChainHandle handle,
+            [MarshalAs(UnmanagedType.Bool)] bool usePadding,
+            IntPtr ioHandle,
+            IoCallbacks callbacks,
+            IntPtr tempIoHandle,
+            IoCallbacks tempCallbacks);
+
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_chain_delete",
             CallingConvention = CallingConvention.Cdecl)]
         static extern void WinMetadataChainDelete(
             IntPtr handle);

+        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_chain_delete",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern void LinuxMetadataChainDelete(
+            IntPtr handle);
+
         [NotNull]
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_iterator_new",
             CallingConvention = CallingConvention.Cdecl)]
         static extern NativeMetadataIteratorHandle WinMetadataIteratorNew();

+        [NotNull]
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_iterator_new",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern NativeMetadataIteratorHandle LinuxMetadataIteratorNew();
+
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_iterator_init",
             CallingConvention = CallingConvention.Cdecl)]
         static extern void WinMetadataIteratorInit(
+            [NotNull] NativeMetadataIteratorHandle handle,
+            [NotNull] NativeMetadataChainHandle chainHandle);
+
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_iterator_init",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern void LinuxMetadataIteratorInit(
             [NotNull] NativeMetadataIteratorHandle handle,
             [NotNull] NativeMetadataChainHandle chainHandle);

@@ -453,15 +691,33 @@
         static extern bool WinMetadataIteratorNext(
             [NotNull] NativeMetadataIteratorHandle handle);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_iterator_next",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxMetadataIteratorNext(
+            [NotNull] NativeMetadataIteratorHandle handle);
+
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_iterator_get_block",
             CallingConvention = CallingConvention.Cdecl)]
         static extern IntPtr WinMetadataIteratorGetBlock(
             [NotNull] NativeMetadataIteratorHandle handle);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_iterator_get_block",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern IntPtr LinuxMetadataIteratorGetBlock(
+            [NotNull] NativeMetadataIteratorHandle handle);
+
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_iterator_insert_block_after",
             CallingConvention = CallingConvention.Cdecl)]
         [return: MarshalAs(UnmanagedType.Bool)]
         static extern bool WinMetadataIteratorInsertBlockAfter(
+            [NotNull] NativeMetadataIteratorHandle handle,
+            [NotNull] NativeMetadataBlockHandle metadataHandle);
+
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_iterator_insert_block_after",
+            CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxMetadataIteratorInsertBlockAfter(
             [NotNull] NativeMetadataIteratorHandle handle,
             [NotNull] NativeMetadataBlockHandle metadataHandle);

@@ -472,10 +728,23 @@
             [NotNull] NativeMetadataIteratorHandle handle,
             [MarshalAs(UnmanagedType.Bool)] bool replaceWithPadding);

+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_iterator_delete_block"
+            , CallingConvention = CallingConvention.Cdecl)]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        static extern bool LinuxMetadataIteratorDeleteBlock(
+            [NotNull] NativeMetadataIteratorHandle handle,
+            [MarshalAs(UnmanagedType.Bool)] bool replaceWithPadding);
+
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [DllImport(_winFlacLibrary, EntryPoint = "FLAC__metadata_iterator_delete",
             CallingConvention = CallingConvention.Cdecl)]
         static extern void WinMetadataIteratorDelete(
+            IntPtr handle);
+
+        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+        [DllImport(_linuxFlacLibrary, EntryPoint = "FLAC__metadata_iterator_delete",
+            CallingConvention = CallingConvention.Cdecl)]
+        static extern void LinuxMetadataIteratorDelete(
             IntPtr handle);
     }
 }


shadow volume action works.

shadow volume action works.

--- CSharpGL/Scene/Actions/DependentActions/3DWorld/ShadowVolumeAction.cs
+++ CSharpGL/Scene/Actions/DependentActions/3DWorld/ShadowVolumeAction.cs
@@ -44,53 +44,56 @@
         /// <param name="param"></param>
         public override void Act(ActionParams param)
         {
-            {
-                //this.colorMask.On();
-
-                //var arg = new RenderEventArgs(this.Scene, param, this.Scene.Camera);
-                //RenderDepthBuffer(this.Scene.RootElement, arg);
-                //this.colorMask.Off();
+            this.depthClamp.On();// for infinite back cap of shadow volumes.
+
+            // Render depth info into depth buffer and ambient color into color buffer.
+            {
                 var arg = new RenderEventArgs(this.Scene, param, this.Scene.Camera);
                 RenderAmbientColor(this.Scene.RootElement, arg);
             }

-            this.stencilTest.On();
+            this.stencilTest.On(); // enable stencil test.
             foreach (var light in this.Scene.Lights)
             {
-                {
-                    // clear stencil buffer.
-                    {
-                        GL.Instance.Clear(GL.GL_STENCIL_BUFFER_BIT); // this seems not working.
-                        // do the same thing.
-                        this.depthTest.On();
-                        this.clearStencilNode.RenderBeforeChildren(null); // this helps clear stencil buffer because `glClear(GL_STENCIL_BUFFER_BIT);` doesn't work on my laptop.
-                        this.depthTest.Off();
-                    }
-                    this.depthMask.On();
-                    this.colorMask.On();
-                    this.depthClamp.On();
-                    this.cullFace.On();
-                    GL.Instance.StencilFunc(GL.GL_ALWAYS, 0, 0xFF);
+                // Clear stencil buffer.
+                {
+                    GL.Instance.Clear(GL.GL_STENCIL_BUFFER_BIT); // this seems not working.
+                    // do the same thing.
+                    this.depthTest.On(); // Disable depth test to make sure this node works for every stencil point.
+                    this.depthMask.On(); // Disable writing to depth buffer.
+                    this.clearStencilNode.RenderBeforeChildren(null); // this helps clear stencil buffer because `glClear(GL_STENCIL_BUFFER_BIT);` doesn't work on my laptop.
+                    this.depthMask.Off();
+                    this.depthTest.Off();
+                }
+                // Extrude shadow volume and save shadow info into stencil buffer.
+                {
+                    this.depthMask.On(); // Disable writing to depth buffer.
+                    this.colorMask.On(); // Disable writing to color buffer.
+                    this.cullFace.On();  // Disable culling face.
+                    GL.Instance.StencilFunc(GL.GL_ALWAYS, 0, 0xFF); // always pass stencil test.
+                    // If depth test fails for back face, increase value in stencil buffer.
                     glStencilOpSeparate(GL.GL_BACK, GL.GL_KEEP, GL.GL_INCR_WRAP, GL.GL_KEEP);
+                    // If depth test fails for front face, decrease value in stencil buffer.
                     glStencilOpSeparate(GL.GL_FRONT, GL.GL_KEEP, GL.GL_DECR_WRAP, GL.GL_KEEP);

+                    // Extrude shadow volume. And shadow info will be saved into stencil buffer automatically according to `glStencilOp...`.
                     var arg = new ShadowVolumeEventArgs(this.Scene.Camera, light);
                     Extrude(this.Scene.RootElement, arg);

                     this.cullFace.Off();
-                    this.depthClamp.Off();
                     this.colorMask.Off();
                     this.depthMask.Off();
                 }
-
-                {
-                    // Draw only if the corresponding stencil value is zero
+                //
+                {
+                    // Draw only if the corresponding stencil value is zero.
                     GL.Instance.StencilFunc(GL.GL_EQUAL, 0x0, 0xFF);
-                    // prevent update to the stencil buffer
+                    // prevent updating to the stencil buffer.
                     GL.Instance.StencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_KEEP);

-                    this.blend.On();
-
+                    this.blend.On(); // add illuminated color to ambient color.
+
+                    // light the scene up.
                     var arg = new RenderEventArgs(this.Scene, param, this.Scene.Camera);
                     RenderUnderLight(this.Scene.RootElement, arg, light);

@@ -99,14 +102,7 @@
             }
             this.stencilTest.Off();

-            //{
-            //    this.blend.On();
-            //    //GL.Instance.Clear(GL.GL_DEPTH_BUFFER_BIT);
-            //    var arg = new RenderEventArgs(this.Scene, param, this.Scene.Camera);
-            //    RenderAmbientColor(this.Scene.RootElement, arg);
-            //    this.blend.Off();
-            //}
-
+            this.depthClamp.Off();
         }

         private void RenderAmbientColor(SceneNodeBase sceneNodeBase, RenderEventArgs arg)


make sure only one enumeration can run at once

--- WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/HardwareWalletOperations.cs
+++ WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/HardwareWalletOperations.cs
@@ -49,7 +49,7 @@
 		{
 			if (device.Fingerprint is null)
 			{
-				throw new Exception("Cannot be null.");
+				throw new Exception("Fingerprint cannot be null.");
 			}

 			var fingerPrint = (HDFingerprint) device.Fingerprint;
@@ -89,6 +89,11 @@

 		public void StartDetection()
 		{
+			if (DetectionTask?.Status == TaskStatus.WaitingForActivation)
+			{
+				return;
+			}
+
 			DetectionTask = RunDetectionAsync();
 		}


Removes Provider notifications due to IDAMS call

--- src/SFA.DAS.Commitments.Notification.WebJob/Program.cs
+++ src/SFA.DAS.Commitments.Notification.WebJob/Program.cs
@@ -34,12 +34,12 @@

             var t1 = notificationJob.RunEmployerAlertSummaryNotification($"{notificationJobId}.Employer")
                 .ContinueWith(t => WhenDone(t, logger, "Employer"));
-            var t2 = notificationJob.RunProviderAlertSummaryNotification($"{notificationJobId}.Provider")
-                .ContinueWith(t => WhenDone(t, logger, "Provider"));
+            //var t2 = notificationJob.RunProviderAlertSummaryNotification($"{notificationJobId}.Provider")
+                //.ContinueWith(t => WhenDone(t, logger, "Provider"));
             var t3 = notificationJob.RunSendingEmployerTransferRequestNotification($"{notificationJobId}.SendingEmployer")
                 .ContinueWith(t => WhenDone(t, logger, "SendingEmployer"));

-            Task.WaitAll(t1, t2, t3);
+            Task.WaitAll(t1, t3);
         }

         private static void WhenDone(Task task, ILog logger, string identifier)


#1 - immproved a test

#1 - immproved a test

--- src/Schema.Hypermedia.Test/HypermediaGeneratorTests.cs
+++ src/Schema.Hypermedia.Test/HypermediaGeneratorTests.cs
@@ -106,18 +106,24 @@
         }

         [Test]
-        public void ItShouldEnrichALinkWithData()
+        public void ItShouldEnrichLinksWithData()
         {
-            string expected = "/v1/12345/John/Doe";
+            var expected = new  [] {"/v1/12345/John/Doe", "/v1/12345/John/Doe/Mr./III"};
+
             var links = new List<Link>()
             {
                 new Link()
                 {
                     Href = "/v1/{id}/{givenName}/{familyName}"
+                },
+                new Link()
+                {
+                    Href = "/v1/{id}/{givenName}/{familyName}/{honorificPrefix}/{honorificSuffix}"
                 }
             };
             generator.EnrichLinksWithData(person, links);
-            Assert.That(links[0].Href, Is.EqualTo(expected));
+            Assert.That(links[0].Href, Is.EqualTo(expected[0]));
+            Assert.That(links[1].Href, Is.EqualTo(expected[1]));
         }

         [Test]


Added basic HTTP authentication support to the CouchDB sink.

--- src/Serilog.Sinks.CouchDB/Sinks/CouchDB/CouchDBSink.cs
+++ src/Serilog.Sinks.CouchDB/Sinks/CouchDB/CouchDBSink.cs
@@ -22,6 +22,7 @@
 using Serilog.Events;
 using Serilog.Formatting.Json;
 using Serilog.Sinks.PeriodicBatching;
+using System.Net.Http.Headers;

 namespace Serilog.Sinks.CouchDB
 {
@@ -52,7 +53,9 @@
         /// <param name="batchPostingLimit">The maximum number of events to post in a single batch.</param>
         /// <param name="period">The time to wait between checking for event batches.</param>
         /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
-        public CouchDBSink(string databaseUrl, int batchPostingLimit, TimeSpan period, IFormatProvider formatProvider)
+        /// <param name="databaseUsername">The username to use in the HTTP Authentication header.</param>
+        /// <param name="databasePassword">Password to use in the HTTP Authentication header</param>
+        public CouchDBSink(string databaseUrl, int batchPostingLimit, TimeSpan period, IFormatProvider formatProvider, string databaseUsername, string databasePassword)
             : base(batchPostingLimit, period)
         {
             if (databaseUrl == null) throw new ArgumentNullException("databaseUrl");
@@ -62,6 +65,10 @@

             _formatProvider = formatProvider;
             _httpClient = new HttpClient { BaseAddress = new Uri(baseAddress) };
+
+            var authByteArray = ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", databaseUsername, databasePassword));
+            var authHeader = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(authByteArray));
+            _httpClient.DefaultRequestHeaders.Authorization = authHeader;
         }

         /// <summary>


Add Fast ToMessage extension to convert byte[] to runtime Message<T>

--- src/ServiceStack.Common/Messaging/MessageExtensions.cs
+++ src/ServiceStack.Common/Messaging/MessageExtensions.cs
@@ -1,3 +1,7 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Threading;
 using ServiceStack.Text;

 namespace ServiceStack.Messaging
@@ -13,13 +17,45 @@
 #endif
 		}

-		public static Message<T> ToMessage<T>(this byte[] bytes)
+        private static Dictionary<Type, ToMessageDelegate> ToMessageFnCache = new Dictionary<Type, ToMessageDelegate>();
+	    internal static ToMessageDelegate GetToMessageFn(Type type)
+        {
+            ToMessageDelegate toMessageFn;
+            ToMessageFnCache.TryGetValue(type, out toMessageFn);
+
+            if (toMessageFn != null) return toMessageFn;
+
+            var genericType = typeof(MessageExtensions<>).MakeGenericType(type);
+            var mi = genericType.GetMethod("ConvertToMessage", BindingFlags.Public | BindingFlags.Static);
+            toMessageFn = (ToMessageDelegate)Delegate.CreateDelegate(typeof(ToMessageDelegate), mi);
+
+            Dictionary<Type, ToMessageDelegate> snapshot, newCache;
+            do
+            {
+                snapshot = ToMessageFnCache;
+                newCache = new Dictionary<Type, ToMessageDelegate>(ToMessageFnCache);
+                newCache[type] = toMessageFn;
+
+            } while (!ReferenceEquals(
+                Interlocked.CompareExchange(ref ToMessageFnCache, newCache, snapshot), snapshot));
+
+            return toMessageFn;
+        }
+
+	    public static IMessage ToMessage(this byte[] bytes, Type ofType)
+	    {
+	        var msgFn = GetToMessageFn(ofType);
+	        var msg = msgFn(bytes);
+	        return msg;
+	    }
+
+	    public static Message<T> ToMessage<T>(this byte[] bytes)
 		{
 			var messageText = ToString(bytes);
             return JsonSerializer.DeserializeFromString<Message<T>>(messageText);
 		}

-		public static byte[] ToBytes(this IMessage message)
+	    public static byte[] ToBytes(this IMessage message)
 		{
             var serializedMessage = JsonSerializer.SerializeToString((object)message);
 			return System.Text.Encoding.UTF8.GetBytes(serializedMessage);
@@ -38,4 +74,15 @@
 		       	: QueueNames<T>.In;
 		}
 	}
+
+    internal delegate IMessage ToMessageDelegate(object param);
+
+    internal static class MessageExtensions<T>
+    {
+        public static IMessage ConvertToMessage(object oBytes)
+        {
+            var bytes = (byte[]) oBytes;
+            return bytes.ToMessage<T>();
+        }
+    }
 }


Update ServiceExtensions.cs

Update ServiceExtensions.cs

Handle null IRedisClientsManager

--- src/ServiceStack.ServiceInterface/ServiceExtensions.cs
+++ src/ServiceStack.ServiceInterface/ServiceExtensions.cs
@@ -111,7 +111,7 @@
         public static ICacheClient GetCacheClient(this IResolver service)
         {
             return service.TryResolve<ICacheClient>()
-                ?? service.TryResolve<IRedisClientsManager>().GetCacheClient()
+                ?? (service.TryResolve<IRedisClientsManager>()!=null ? service.TryResolve<IRedisClientsManager>().GetCacheClient():null)
                 ?? DefaultCache;
         }


gary/mo 1047 AtoZ include showcase

gary/mo 1047 AtoZ include showcase

--- src/StockportContentApi/Repositories/AtoZRepository.cs
+++ src/StockportContentApi/Repositories/AtoZRepository.cs
@@ -37,6 +37,7 @@
             var atozItems = new List<AtoZ>();
             atozItems.AddRange(await GetAtoZItemFromContentType("article", letter));
             atozItems.AddRange(await GetAtoZItemFromContentType("topic", letter));
+            atozItems.AddRange(await GetAtoZItemFromContentType("showcase", letter));

             atozItems = atozItems.OrderBy(o => o.Title).ToList();


Compatibility work for Mono

Compatibility work for Mono

--- src/Susanoo.Core/ResultSets/CommandResultExpression.cs
+++ src/Susanoo.Core/ResultSets/CommandResultExpression.cs
@@ -1,6 +1,7 @@
 using Susanoo.Command;
 using Susanoo.Mapping;
 using System;
+

 namespace Susanoo.ResultSets
 {
@@ -21,7 +22,11 @@
         {
             MappingStorage = mappingStorage;

-            Command = command;
+            // ReSharper disable ArrangeThisQualifier
+            //Mono required
+
+            this.Command = command;
+            // ReSharper restore ArrangeThisQualifier
         }

         /// <summary>


bump version part 2

bump version part 2

--- letsencrypt-win-simple/Properties/AssemblyInfo.cs
+++ letsencrypt-win-simple/Properties/AssemblyInfo.cs
@@ -33,7 +33,7 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("198.0.*")]
+// [assembly: AssemblyVersion("198.1.*")]

-[assembly: AssemblyVersion("198.0.*")]
-[assembly: AssemblyFileVersion("1.9.8.0")]
+[assembly: AssemblyVersion("198.1.*")]
+[assembly: AssemblyFileVersion("1.9.8.1")]


Removes Availability from default smoke test to avoid time problems

--- Digipost.Signature.Api.Client.Portal.Tests/Utilities/DomainUtility.cs
+++ Digipost.Signature.Api.Client.Portal.Tests/Utilities/DomainUtility.cs
@@ -25,13 +25,7 @@

         public static Job GetPortalJob()
         {
-            return new Job(GetPortalDocument(), GetSigner(), "PortalJobReference")
-            {
-                Availability = new Availability
-                {
-                    AvailableFor = new TimeSpan(0, 0, 10, 0)
-                }
-            };
+            return new Job(GetPortalDocument(), GetSigner(), "PortalJobReference");
         }

         internal static Manifest GetPortalManifest()


Reinstate piece of license removed accidentally

--- src/TestCentric/testcentric.gui/Views/ITestTreeView.cs
+++ src/TestCentric/testcentric.gui/Views/ITestTreeView.cs
@@ -11,6 +11,15 @@
 //
 // The above copyright notice and this permission notice shall be
 // included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ***********************************************************************

 namespace TestCentric.Gui.Views
 {


Remove last casting to LucenIndex

Remove last casting to LucenIndex

--- src/Umbraco.Web/Editors/ExamineManagementController.cs
+++ src/Umbraco.Web/Editors/ExamineManagementController.cs
@@ -85,7 +85,7 @@
             };
         }

-
+

         /// <summary>
         /// Check if the index has been rebuilt
@@ -250,7 +250,7 @@

         private void Indexer_IndexOperationComplete(object sender, EventArgs e)
         {
-            var indexer = (LuceneIndex)sender;
+            var indexer = (IIndex)sender;

             _logger.Debug<ExamineManagementController>("Logging operation completed for index {IndexName}", indexer.Name);

@@ -259,7 +259,7 @@

             _logger
                 .Info<ExamineManagementController
-                >($"Rebuilding index '{indexer.Name}' done, {indexer.CommitCount} items committed (can differ from the number of items in the index)");
+                >($"Rebuilding index '{indexer.Name}' done.");

             var cacheKey = "temp_indexing_op_" + indexer.Name;
             _runtimeCache.Clear(cacheKey);


refactored multipolygon to properly close json array (#6)

--- src/GeoJSON.Net/Converters/MultiPolygonConverter.cs
+++ src/GeoJSON.Net/Converters/MultiPolygonConverter.cs
@@ -56,47 +56,46 @@
         /// <param name="serializer">The calling serializer.</param>
         public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
         {
-            var polygons = (List<Polygon>)value;
-
-            writer.WriteStartArray();
-
-            if (polygons != null && polygons.Count > 0)
+            var polygons = value as List<Polygon>;
+
+            if (polygons != null)
             {
-                for (int i = 0; i < polygons.Count; i++)
+                writer.WriteStartArray();
+                foreach (var polygon in polygons)
                 {
-                    var polygon = polygons[i];
-
                     // start of polygon
                     writer.WriteStartArray();

-                    for (int j = 0; j < polygon.Coordinates.Count; j++)
+                    foreach (var lineString in polygon.Coordinates ?? new List<LineString>())
                     {
-                        var lineString = polygon.Coordinates[j];
-                        var coordinateElements = lineString.Coordinates.OfType<GeographicPosition>();
-                        if (coordinateElements.Any())
+                        var coordinateElements = (lineString.Coordinates ?? new List<IPosition>())
+                            .OfType<GeographicPosition>()
+                            .ToList();
+
+                        if (coordinateElements.Count == 0)
+                            continue;
+
+                        // start linear rings of polygon
+                        writer.WriteStartArray();
+
+                        foreach (var position in coordinateElements)
                         {
-                            // start linear rings of polygon
+                            var coordinates = position;
+
                             writer.WriteStartArray();

-                            foreach (var position in coordinateElements)
+                            writer.WriteValue(coordinates.Longitude);
+                            writer.WriteValue(coordinates.Latitude);
+
+                            if (coordinates.Altitude.HasValue)
                             {
-                                var coordinates = position;
-
-                                writer.WriteStartArray();
-
-                                writer.WriteValue(coordinates.Longitude);
-                                writer.WriteValue(coordinates.Latitude);
-
-                                if (coordinates.Altitude.HasValue)
-                                {
-                                    writer.WriteValue(coordinates.Altitude.Value);
-                                }
-
-                                writer.WriteEndArray();
+                                writer.WriteValue(coordinates.Altitude.Value);
                             }

                             writer.WriteEndArray();
                         }
+
+                        writer.WriteEndArray();
                     }

                     writer.WriteEndArray();


Added unknown fragment test case

Added unknown fragment test case

--- src/GraphQL.Tests/StarWars/StarWarsFragmentTests.cs
+++ src/GraphQL.Tests/StarWars/StarWarsFragmentTests.cs
@@ -1,4 +1,4 @@
-using Xunit;
+using Xunit;

 namespace GraphQL.Tests.StarWars
 {
@@ -77,5 +77,24 @@

             AssertQuerySuccess(query, expected);
         }
+
+        [Fact]
+        public void use_undefined_fragment()
+        {
+            var query = @"
+                query someDroids {
+                    r2d2: droid(id: ""3"") {
+                        ...unknown_fragment
+                        name
+                    }
+               }
+            ";
+            var errors = new ExecutionErrors();
+            var error = new ExecutionError(@"Unknown fragment ""unknown_fragment"".");
+            error.AddLocation(4, 25);
+            errors.Add(error);
+
+            AssertQuery(query, CreateQueryResult(null, errors), null, null);
+        }
     }
 }


Fixing build error: Changing override to protected

--- src/Microsoft.Fx.Portability.Cci/HostEnvironment.cs
+++ src/Microsoft.Fx.Portability.Cci/HostEnvironment.cs
@@ -185,7 +185,7 @@
             //".ni.exe" Do these actually exist?
         };

-        public override AssemblyIdentity Probe(string probeDir, AssemblyIdentity referencedAssembly)
+        protected override AssemblyIdentity Probe(string probeDir, AssemblyIdentity referencedAssembly)
         {
             Contract.Requires(probeDir != null);
             Contract.Requires(referencedAssembly != null);
@@ -216,7 +216,7 @@
             return null;
         }

-        public override AssemblyIdentity GetCoreAssemblySymbolicIdentity()
+        protected override AssemblyIdentity GetCoreAssemblySymbolicIdentity()
         {
             // If explicitly set return that identity
             if (_coreAssemblyIdentity != null)


Use post for check linked items api method

--- src/Our.Umbraco.Nexu.Web/Api/RelationCheckApiController.cs
+++ src/Our.Umbraco.Nexu.Web/Api/RelationCheckApiController.cs
@@ -49,8 +49,17 @@
             return this.Request.CreateResponse(HttpStatusCode.OK, relations);
         }

-        [HttpGet]
-        public HttpResponseMessage CheckLinkedItems(string[] udis)
+        /// <summary>
+        /// Checks a list of udi's for linked items
+        /// </summary>
+        /// <param name="udis">
+        /// The udis.
+        /// </param>
+        /// <returns>
+        /// The <see cref="HttpResponseMessage"/>.
+        /// </returns>
+        [HttpPost]
+        public HttpResponseMessage CheckLinkedItems([FromBody] string[] udis)
         {
             var listUdis = new List<Udi>();


Improve code generator editor experience (#7152)

--- src/Orleans.CodeGenerator/OrleansSourceGenerator.cs
+++ src/Orleans.CodeGenerator/OrleansSourceGenerator.cs
@@ -1,6 +1,7 @@
 using Microsoft.CodeAnalysis;
 using Microsoft.CodeAnalysis.Text;
 using System;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;

@@ -11,40 +12,46 @@
     {
         public void Execute(GeneratorExecutionContext context)
         {
-            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.Orleans_designtimebuild", out var isDesignTimeBuild)
+            var processName = Process.GetCurrentProcess().ProcessName.ToLowerInvariant();
+            if (processName.Contains("devenv") || processName.Contains("servicehub"))
+            {
+                return;
+            }
+
+            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.orleans_designtimebuild", out var isDesignTimeBuild)
                 && string.Equals("true", isDesignTimeBuild, StringComparison.OrdinalIgnoreCase))
             {
                 return;
             }
-
-            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.Orleans_attachdebugger", out var attachDebuggerOption)
+
+            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.orleans_attachdebugger", out var attachDebuggerOption)
                 && string.Equals("true", attachDebuggerOption, StringComparison.OrdinalIgnoreCase))
             {
-                System.Diagnostics.Debugger.Launch();
+                Debugger.Launch();
             }

             var options = new CodeGeneratorOptions();
-            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.Orleans_immutableattributes", out var immutableAttributes) && immutableAttributes is {Length: > 0 })
+            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.orleans_immutableattributes", out var immutableAttributes) && immutableAttributes is {Length: > 0 })
             {
                 options.ImmutableAttributes.AddRange(immutableAttributes.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList());
             }

-            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.Orleans_aliasattributes", out var aliasAttributes) && aliasAttributes is {Length: > 0 })
+            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.orleans_aliasattributes", out var aliasAttributes) && aliasAttributes is {Length: > 0 })
             {
                 options.AliasAttributes.AddRange(aliasAttributes.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList());
             }

-            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.Orleans_idattributes", out var idAttributes) && idAttributes is {Length: > 0 })
+            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.orleans_idattributes", out var idAttributes) && idAttributes is {Length: > 0 })
             {
                 options.IdAttributes.AddRange(idAttributes.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList());
             }

-            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.Orleans_generateserializerattributes", out var generateSerializerAttributes) && generateSerializerAttributes is {Length: > 0 })
+            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.orleans_generateserializerattributes", out var generateSerializerAttributes) && generateSerializerAttributes is {Length: > 0 })
             {
                 options.GenerateSerializerAttributes.AddRange(generateSerializerAttributes.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList());
             }

-            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.Orleans_generatefieldids", out var generateFieldIds) && generateFieldIds is {Length: > 0 })
+            if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.orleans_generatefieldids", out var generateFieldIds) && generateFieldIds is {Length: > 0 })
             {
                 options.GenerateFieldIds = bool.Parse(generateFieldIds);
             }


Quarantine all ProjectTemplate tests until dotnet new lock issue is resolved.

- Investigation pending in https://github.com/dotnet/aspnetcore/issues/21748

--- src/ProjectTemplates/test/AssemblyInfo.AssemblyFixtures.cs
+++ src/ProjectTemplates/test/AssemblyInfo.AssemblyFixtures.cs
@@ -10,3 +10,5 @@

 [assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(ProjectFactoryFixture))]
 [assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(SeleniumStandaloneServer))]
+
+[assembly: QuarantinedTest("Investigation pending in https://github.com/dotnet/aspnetcore/issues/21748")]


Connect dewww request packets to the land module to makle dwell work

--- OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
+++ OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
@@ -120,6 +120,7 @@
             client.OnParcelGodForceOwner += new ParcelGodForceOwner(handleParcelGodForceOwner);
             client.OnParcelReclaim += new ParcelReclaim(handleParcelReclaim);
             client.OnParcelInfoRequest += new ParcelInfoRequest(handleParcelInfo);
+            client.OnParcelDwellRequest += new ParcelDwellRequest(handleParcelDwell);
             if (m_scene.Entities.ContainsKey(client.AgentId))
             {
                 SendLandUpdate((ScenePresence)m_scene.Entities[client.AgentId], true);
@@ -1261,6 +1262,18 @@

         #endregion

+        private void handleParcelDwell(int localID, IClientAPI remoteClient)
+        {
+            ILandObject selectedParcel = null;
+            lock (m_landList)
+            {
+                if (!m_landList.TryGetValue(localID, out selectedParcel))
+                    return;
+            }
+
+            remoteClient.SendParcelDwellReply(localID, selectedParcel.landData.GlobalID,  selectedParcel.landData.Dwell);
+        }
+
         private void handleParcelInfo(IClientAPI remoteClient, UUID parcelID)
         {
             if (parcelID == UUID.Zero)


fix dpi issues in WPF

fix dpi issues in WPF

--- Signum.Windows.Extensions/SynthaxHighlight/SyntaxHighlightBox.xaml.cs
+++ Signum.Windows.Extensions/SynthaxHighlight/SyntaxHighlightBox.xaml.cs
@@ -70,7 +70,9 @@
                 lineNumbersCanvas = (DrawingControl)Template.FindName("PART_LineNumbersCanvas", this);
                 scrollViewer = (ScrollViewer)Template.FindName("PART_ContentHost", this);

-                lineNumbersCanvas.Width = GetFormattedTextWidth(string.Format("{0:0000}", totalLineCount)) + 5;
+                var dpi = VisualTreeHelper.GetDpi(this);
+
+                lineNumbersCanvas.Width = GetFormattedTextWidth(string.Format("{0:0000}", totalLineCount), dpi) + 5;

                 scrollViewer.ScrollChanged += OnScrollChanged;

@@ -82,7 +84,10 @@
             {
                 if (e.HeightChanged == false)
                     return;
-                UpdateBlocks();
+
+                var dpi = VisualTreeHelper.GetDpi(this);
+
+                UpdateBlocks(dpi);
                 InvalidateVisual();
             };

@@ -103,7 +108,11 @@
         private void OnScrollChanged(object sender, ScrollChangedEventArgs e)
         {
             if (e.VerticalChange != 0)
-                UpdateBlocks();
+            {
+                var dpi = VisualTreeHelper.GetDpi(this);
+                UpdateBlocks(dpi);
+            }
+
             InvalidateVisual();
         }

@@ -111,7 +120,7 @@
         // Updating & Block managing
         // -----------------------------------------------------------

-        private void UpdateBlocks()
+        private void UpdateBlocks(DpiScale dpi)
         {
             if (blocks.Count == 0)
                 return;
@@ -140,15 +149,17 @@
                     LineHeight);

                 block.RawText = block.GetSubString(Text);
-                block.LineNumbers = GetFormattedLineNumbers(block.LineStartIndex, block.LineEndIndex);
+                block.LineNumbers = GetFormattedLineNumbers(block.LineStartIndex, block.LineEndIndex, dpi);
                 blocks.Add(block);
-                FormatBlock(block);
+                FormatBlock(block, dpi);
             }
         }

         private void InvalidateBlocks(int changeOffset)
         {
             InnerTextBlock blockChanged = blocks.FirstOrDefault(b=>b.CharStartIndex <= changeOffset && changeOffset <= b.CharEndIndex + 1);
+
+            var dpi = VisualTreeHelper.GetDpi(this);

             if (blockChanged == null && changeOffset > 0)
                 blockChanged = blocks.Last();
@@ -179,7 +190,7 @@
                         lineStart + TextUtilities.GetLineCount(blockText) - 1,
                         LineHeight);
                     block.RawText = block.GetSubString(Text);
-                    block.LineNumbers = GetFormattedLineNumbers(block.LineStartIndex, block.LineEndIndex);
+                    block.LineNumbers = GetFormattedLineNumbers(block.LineStartIndex, block.LineEndIndex, dpi);
                     block.IsLast = true;

                     foreach (InnerTextBlock b in blocks)
@@ -187,7 +198,7 @@
                             throw new Exception();

                     blocks.Add(block);
-                    FormatBlock(block);
+                    FormatBlock(block, dpi);
                     break;
                 }
                 if (localLineCount > maxLineCountInBlock)
@@ -199,14 +210,14 @@
                         lineStart + maxLineCountInBlock - 1,
                         LineHeight);
                     block.RawText = block.GetSubString(Text);
-                    block.LineNumbers = GetFormattedLineNumbers(block.LineStartIndex, block.LineEndIndex);
+                    block.LineNumbers = GetFormattedLineNumbers(block.LineStartIndex, block.LineEndIndex, dpi);

                     foreach (InnerTextBlock b in blocks)
                         if (b.LineStartIndex == block.LineStartIndex)
                             throw new Exception();

                     blocks.Add(block);
-                    FormatBlock(block);
+                    FormatBlock(block, dpi);

                     charStart = i + 1;
                     lineStart += maxLineCountInBlock;
@@ -226,6 +237,9 @@
         {
             if (!IsLoaded || renderCanvas == null || lineNumbersCanvas == null)
                 return;
+
+
+            var dpi = VisualTreeHelper.GetDpi(this);

             using (DrawingContext dc = renderCanvas.GetContext())
             using (DrawingContext dc2 = lineNumbersCanvas.GetContext())
@@ -242,7 +256,7 @@
                             dc.DrawText(block.FormattedText, new Point(2 - HorizontalOffset, block.Position.Y - VerticalOffset));
                             if (IsLineNumbersMarginVisible)
                             {
-                                lineNumbersCanvas.Width = GetFormattedTextWidth(string.Format("{0:0000}", totalLineCount)) + 5;
+                                lineNumbersCanvas.Width = GetFormattedTextWidth(string.Format("{0:0000}", totalLineCount), dpi) + 5;
                                 dc2.DrawText(block.LineNumbers, new Point(lineNumbersCanvas.ActualWidth, 1 + block.Position.Y - VerticalOffset));
                             }
                         }
@@ -285,9 +299,9 @@
         /// <summary>
         /// Formats and Highlights the text of a block.
         /// </summary>
-        private void FormatBlock(InnerTextBlock currentBlock)
-        {
-            currentBlock.FormattedText = GetFormattedText(currentBlock.RawText);
+        private void FormatBlock(InnerTextBlock currentBlock, DpiScale dpi)
+        {
+            currentBlock.FormattedText = GetFormattedText(currentBlock.RawText, dpi);
             if (CurrentHighlighter != null)
             {
                 ThreadPool.QueueUserWorkItem(p =>
@@ -301,7 +315,7 @@
         /// <summary>
         /// Returns a formatted text object from the given string
         /// </summary>
-        private FormattedText GetFormattedText(string text)
+        private FormattedText GetFormattedText(string text, DpiScale dpi)
         {
             FormattedText ft = new FormattedText(
                 text,
@@ -309,7 +323,8 @@
                 FlowDirection.LeftToRight,
                 new Typeface(FontFamily, FontStyle, FontWeight, FontStretch),
                 FontSize,
-                Brushes.Black)
+                Brushes.Black,
+                dpi.PixelsPerDip)
             {
                 Trimming = TextTrimming.None,
                 LineHeight = lineHeight
@@ -320,7 +335,7 @@
         /// <summary>
         /// Returns a string containing a list of numbers separated with newlines.
         /// </summary>
-        private FormattedText GetFormattedLineNumbers(int firstIndex, int lastIndex)
+        private FormattedText GetFormattedLineNumbers(int firstIndex, int lastIndex, DpiScale dpi)
         {
             string text = "";
             for (int i = firstIndex + 1; i <= lastIndex + 1; i++)
@@ -333,7 +348,7 @@
                 FlowDirection.LeftToRight,
                 new Typeface(FontFamily, FontStyle, FontWeight, FontStretch),
                 FontSize,
-                new SolidColorBrush(Color.FromRgb(0x21, 0xA1, 0xD8)))
+                new SolidColorBrush(Color.FromRgb(0x21, 0xA1, 0xD8)), dpi.PixelsPerDip)
             {
                 Trimming = TextTrimming.None,
                 LineHeight = lineHeight,
@@ -345,7 +360,7 @@
         /// <summary>
         /// Returns the width of a text once formatted.
         /// </summary>
-        private double GetFormattedTextWidth(string text)
+        private double GetFormattedTextWidth(string text, DpiScale dpi)
         {
             FormattedText ft = new FormattedText(
                 text,
@@ -353,7 +368,8 @@
                 FlowDirection.LeftToRight,
                 new Typeface(FontFamily, FontStyle, FontWeight, FontStretch),
                 FontSize,
-                Brushes.Black)
+                Brushes.Black,
+                dpi.PixelsPerDip)
             {
                 Trimming = TextTrimming.None,
                 LineHeight = lineHeight


Corrected a bad merge

Corrected a bad merge

--- src/Pickles/Pickles/TestFrameworks/MsTestResults.cs
+++ src/Pickles/Pickles/TestFrameworks/MsTestResults.cs
@@ -152,54 +152,5 @@
         }

         #endregion
-
-        private XDocument ReadResultsFile()
-        {
-            XDocument document;
-            using (FileStream stream = configuration.TestResultsFile.OpenRead())
-            {
-                XmlReader xmlReader = XmlReader.Create(stream);
-                document = XDocument.Load(xmlReader);
-                stream.Close();
-            }
-            return document;
-        }
-
-        private Guid GetScenarioExecutionId(Scenario scenario)
-        {
-            string idString =
-                (from unitTest in resultsDocument.Root.Descendants(ns + "UnitTest")
-                 let properties = unitTest.Element(ns + "Properties")
-                 let property = properties.Element(ns + "Property")
-                 let key = property.Element(ns + "Key")
-                 let value = property.Element(ns + "Value")
-                 where key.Value == "FeatureTitle" && value.Value == scenario.Feature.Name
-                 let description = unitTest.Element(ns + "Description")
-                 where description.Value == scenario.Name
-                 let id = unitTest.Element(ns + "Execution").Attribute("id").Value
-                 select id).FirstOrDefault();
-
-            return !string.IsNullOrEmpty(idString) ? new Guid(idString) : Guid.Empty;
-        }
-
-        private TestResult GetExecutionResult(Guid scenarioExecutionId)
-        {
-            string resultText =
-                (from unitTestResult in resultsDocument.Root.Descendants(ns + "UnitTestResult")
-                 let executionId = new Guid(unitTestResult.Attribute("executionId").Value)
-                 where scenarioExecutionId == executionId
-                 let outcome = unitTestResult.Attribute("outcome").Value
-                 select outcome).FirstOrDefault() ?? string.Empty;
-
-            switch (resultText.ToLowerInvariant())
-            {
-                case "passed":
-                    return new TestResult {WasExecuted = true, WasSuccessful = true};
-                case "failed":
-                    return new TestResult {WasExecuted = true, WasSuccessful = false};
-                default:
-                    return new TestResult {WasExecuted = false, WasSuccessful = false};
-            }
-        }
     }
 }


Bug fix

Bug fix

--- src/Qwack.Core/Instruments/Funding/FloatingRateLoanDepo.cs
+++ src/Qwack.Core/Instruments/Funding/FloatingRateLoanDepo.cs
@@ -29,7 +29,8 @@
                 Currency = floatRateIndex.Currency,
                 Direction = SwapPayReceiveType.Pay,
                 NotionalExchange = ExchangeType.Both,
-                LegType = SwapLegType.Float
+                LegType = SwapLegType.Float,
+                FixedRateOrMargin = Convert.ToDecimal(spread)
             };
             var schedule = leg.GenerateSchedule();

@@ -145,7 +146,7 @@
             Notional = Notional,
         };

-        public IAssetInstrument SetStrike(double strike)=> throw new NotImplementedException();
+        public IAssetInstrument SetStrike(double strike) => (FloatingRateLoanDepo)SetParRate(strike);

         public List<CashFlow> ExpectedCashFlows(IAssetFxModel model)
         {


Added count of displayed sessions

Added count of displayed sessions

--- src/Swetugg.Web/Areas/Admin/Views/CfpSelection/List.cshtml
+++ src/Swetugg.Web/Areas/Admin/Views/CfpSelection/List.cshtml
@@ -25,7 +25,8 @@

-

+

+	Count:

 @section scripts
@@ -67,6 +68,8 @@
 								(!filter.Status || session.Status && session.Status.indexOf(filter.Status) > -1) &&
 								(filter.IsDecided == undefined || session.IsDecided === filter.IsDecided));
 						});
+
+					$("#session_count").text(filteredData.length);

 					d.resolve(filteredData);
 				});


Refactor ExecutorLogger a little so that it has a list of IExecutorEventHandlers rather than individual fields. In principle this should make it a little easier to add other loggers.

--- src/Symbooglix/Executor/ExecutorHandlers/ExecutorLogger.cs
+++ src/Symbooglix/Executor/ExecutorHandlers/ExecutorLogger.cs
@@ -1,5 +1,6 @@
 using System;
 using System.IO;
+using System.Collections.Generic;

 namespace Symbooglix
 {
@@ -22,16 +23,15 @@
         public DirectoryInfo TerminatedExecutionStatesDir
         {
             get;
-            private set;
+            protected set;
         }

-        private ExecutionStateLogger TerminatedStateConstraintsLogger;
-        private ExecutionStateLogger TerminatedStateUnsatCoreLogger;
-        private ExecutionStateLogger TerminatedStateInfoLogger;
+        private List<IExecutorEventHandler> Loggers;

         public ExecutorLogger(string path, bool makeDirectoryInPath)
         {
             this.Root = null;
+            this.Loggers = new List<IExecutorEventHandler>();

             if (makeDirectoryInPath)
             {
@@ -75,34 +75,32 @@
                 }
             }

+            CreateDirectories();
             SetupLoggers();
         }

-        private void CreateDirectories()
+        protected virtual void CreateDirectories()
         {
             TerminatedExecutionStatesDir = Directory.CreateDirectory(Path.Combine(this.Root.FullName, "terminated_states"));
         }

         protected virtual void SetupLoggers()
         {
-            CreateDirectories();
-            TerminatedStateConstraintsLogger = new ExecutionStateConstraintLogger(this.TerminatedExecutionStatesDir.FullName);
-            TerminatedStateUnsatCoreLogger = new ExecutionStateUnSatCoreLogger(this.TerminatedExecutionStatesDir.FullName);
-            TerminatedStateInfoLogger = new ExecutionStateInfoLogger(this.TerminatedExecutionStatesDir.FullName);
+            Loggers.Add(new ExecutionStateConstraintLogger(this.TerminatedExecutionStatesDir.FullName));
+            Loggers.Add(new ExecutionStateUnSatCoreLogger(this.TerminatedExecutionStatesDir.FullName));
+            Loggers.Add(new ExecutionStateInfoLogger(this.TerminatedExecutionStatesDir.FullName));
         }

         public void Connect(Executor e)
         {
-            TerminatedStateConstraintsLogger.Connect(e);
-            TerminatedStateUnsatCoreLogger.Connect(e);
-            TerminatedStateInfoLogger.Connect(e);
+            foreach (var logger in Loggers)
+                logger.Connect(e);
         }

         public void Disconnect(Executor e)
         {
-            TerminatedStateConstraintsLogger.Disconnect(e);
-            TerminatedStateUnsatCoreLogger.Disconnect(e);
-            TerminatedStateInfoLogger.Disconnect(e);
+            foreach (var logger in Loggers)
+                logger.Disconnect(e);
         }
     }
 }


Attach current stack if exception is null

--- src/Serilog.Sinks.Raygun/Sinks/Raygun/RaygunSink.cs
+++ src/Serilog.Sinks.Raygun/Sinks/Raygun/RaygunSink.cs
@@ -14,8 +14,10 @@

 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Reflection;
+using System.Text;
 using Mindscape.Raygun4Net;
 #if NETSTANDARD2_0
 using Mindscape.Raygun4Net.AspNetCore;
@@ -114,7 +116,8 @@
                 {
                     ClassName = logEvent.MessageTemplate.Text,
                     Message = logEvent.MessageTemplate.Text,
-                    Data = logEvent.Properties.ToDictionary(k => k.Key, v => v.Value.ToString())
+                    Data = logEvent.Properties.ToDictionary(k => k.Key, v => v.Value.ToString()),
+                    StackTrace = BuildStackTrace(new StackTrace())
                 };

             // Add user when requested
@@ -285,5 +288,108 @@

             return userIdentifier;
         }
+
+        private static RaygunErrorStackTraceLineMessage[] BuildStackTrace(StackTrace stackTrace)
+        {
+            var lines = new List<RaygunErrorStackTraceLineMessage>();
+
+            var frames = stackTrace.GetFrames();
+
+            if (frames == null || frames.Length == 0)
+            {
+                var line = new RaygunErrorStackTraceLineMessage { FileName = "none", LineNumber = 0 };
+                lines.Add(line);
+                return lines.ToArray();
+            }
+
+            foreach (StackFrame frame in frames)
+            {
+                MethodBase method = frame.GetMethod();
+
+                if (method != null)
+                {
+                    int lineNumber = frame.GetFileLineNumber();
+
+                    if (lineNumber == 0)
+                    {
+                        lineNumber = frame.GetILOffset();
+                    }
+
+                    var methodName = GenerateMethodName(method);
+
+                    string file = frame.GetFileName();
+
+                    string className = method.ReflectedType != null ? method.ReflectedType.FullName : "(unknown)";
+
+                    var line = new RaygunErrorStackTraceLineMessage
+                    {
+                        FileName = file,
+                        LineNumber = lineNumber,
+                        MethodName = methodName,
+                        ClassName = className
+                    };
+
+                    lines.Add(line);
+                }
+            }
+
+            return lines.ToArray();
+        }
+
+        private static string GenerateMethodName(MethodBase method)
+        {
+            var stringBuilder = new StringBuilder();
+
+            stringBuilder.Append(method.Name);
+
+            bool first = true;
+            if (method is MethodInfo && method.IsGenericMethod)
+            {
+                Type[] genericArguments = method.GetGenericArguments();
+                stringBuilder.Append("[");
+                for (int i = 0; i < genericArguments.Length; i++)
+                {
+                    if (!first)
+                    {
+                        stringBuilder.Append(",");
+                    }
+                    else
+                    {
+                        first = false;
+                    }
+
+                    stringBuilder.Append(genericArguments[i].Name);
+                }
+
+                stringBuilder.Append("]");
+            }
+
+            stringBuilder.Append("(");
+            ParameterInfo[] parameters = method.GetParameters();
+            first = true;
+            for (int i = 0; i < parameters.Length; ++i)
+            {
+                if (!first)
+                {
+                    stringBuilder.Append(", ");
+                }
+                else
+                {
+                    first = false;
+                }
+
+                string type = "<UnknownType>";
+                if (parameters[i].ParameterType != null)
+                {
+                    type = parameters[i].ParameterType.Name;
+                }
+
+                stringBuilder.Append(type + " " + parameters[i].Name);
+            }
+
+            stringBuilder.Append(")");
+
+            return stringBuilder.ToString();
+        }
     }
 }


Update StackTrace tests after nullable changes

--- src/System.Diagnostics.StackTrace/tests/StackTraceTests.cs
+++ src/System.Diagnostics.StackTrace/tests/StackTraceTests.cs
@@ -69,11 +69,11 @@
         }

         [Fact]
-        public void Ctor_LargeSkipFrames_GetFramesReturnsNull()
+        public void Ctor_LargeSkipFrames_GetFramesReturnsEmtpy()
         {
             var stackTrace = new StackTrace(int.MaxValue);
             Assert.Equal(0, stackTrace.FrameCount);
-            Assert.Null(stackTrace.GetFrames());
+            Assert.Empty(stackTrace.GetFrames());
         }

         [Theory]
@@ -96,11 +96,11 @@
         [Theory]
         [InlineData(true)]
         [InlineData(false)]
-        public void Ctor_LargeSkipFramesFNeedFileInfo_GetFramesReturnsNull(bool fNeedFileInfo)
+        public void Ctor_LargeSkipFramesFNeedFileInfo_GetFramesReturnsEmpty(bool fNeedFileInfo)
         {
             var stackTrace = new StackTrace(int.MaxValue, fNeedFileInfo);
             Assert.Equal(0, stackTrace.FrameCount);
-            Assert.Null(stackTrace.GetFrames());
+            Assert.Empty(stackTrace.GetFrames());
         }

         [Fact]
@@ -111,12 +111,12 @@
         }

         [Fact]
-        public void Ctor_EmptyException_GetFramesReturnsNull()
+        public void Ctor_EmptyException_GetFramesReturnsEmpty()
         {
             var exception = new Exception();
             var stackTrace = new StackTrace(exception);
             Assert.Equal(0, stackTrace.FrameCount);
-            Assert.Null(stackTrace.GetFrames());
+            Assert.Empty(stackTrace.GetFrames());
             Assert.Null(stackTrace.GetFrame(0));
         }

@@ -137,7 +137,7 @@
             var exception = new Exception();
             var stackTrace = new StackTrace(exception, fNeedFileInfo);
             Assert.Equal(0, stackTrace.FrameCount);
-            Assert.Null(stackTrace.GetFrames());
+            Assert.Empty(stackTrace.GetFrames());
             Assert.Null(stackTrace.GetFrame(0));
         }

@@ -167,7 +167,7 @@
         {
             var stackTrace = new StackTrace(InvokeException(), int.MaxValue);
             Assert.Equal(0, stackTrace.FrameCount);
-            Assert.Null(stackTrace.GetFrames());
+            Assert.Empty(stackTrace.GetFrames());
         }

         [Fact]
@@ -175,7 +175,7 @@
         {
             var stackTrace = new StackTrace(new Exception(), 0);
             Assert.Equal(0, stackTrace.FrameCount);
-            Assert.Null(stackTrace.GetFrames());
+            Assert.Empty(stackTrace.GetFrames());
             Assert.Null(stackTrace.GetFrame(0));
         }

@@ -208,7 +208,7 @@
         {
             var stackTrace = new StackTrace(InvokeException(), int.MaxValue);
             Assert.Equal(0, stackTrace.FrameCount);
-            Assert.Null(stackTrace.GetFrames());
+            Assert.Empty(stackTrace.GetFrames());
         }

         [Theory]
@@ -218,7 +218,7 @@
         {
             var stackTrace = new StackTrace(new Exception(), 0, fNeedFileInfo);
             Assert.Equal(0, stackTrace.FrameCount);
-            Assert.Null(stackTrace.GetFrames());
+            Assert.Empty(stackTrace.GetFrames());
             Assert.Null(stackTrace.GetFrame(0));
         }


Adds simpler test to validate RefreshNode

--- src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
+++ src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
@@ -1065,6 +1065,60 @@
             AssertLinkedNode(child3.contentNode, 1, 2, -1, -1, -1);
         }

+        [Test]
+        public void Refresh_Node_Ensures_Linked_list()
+        {
+            // NOTE: these tests are not using real scopes, in which case a Scope does not control
+            // how the snapshots generations work. We are forcing new snapshot generations manually.
+
+            IEnumerable<ContentNodeKit> GetKits()
+            {
+                var paths = new Dictionary<int, string> { { -1, "-1" } };
+
+                //root
+                yield return CreateInvariantKit(100, -1, 1, paths);
+
+                //site
+                yield return CreateInvariantKit(2, 100, 1, paths);
+                yield return CreateInvariantKit(1, 100, 2, paths); //middle child
+                yield return CreateInvariantKit(3, 100, 3, paths);
+
+                //children of 1
+                yield return CreateInvariantKit(20, 1, 1, paths);
+                yield return CreateInvariantKit(30, 1, 2, paths);
+                yield return CreateInvariantKit(40, 1, 3, paths);
+            }
+
+            Init(GetKits());
+
+            var snapshotService = (PublishedSnapshotService)_snapshotService;
+            var contentStore = snapshotService.GetContentStore();
+
+            Assert.AreEqual(1, contentStore.Test.LiveGen);
+            Assert.IsTrue(contentStore.Test.NextGen);
+
+            var middleNode = contentStore.Test.GetValues(1)[0];
+            Assert.AreEqual(1, middleNode.gen);
+            AssertLinkedNode(middleNode.contentNode, 100, 2, 3, 20, 40);
+
+            //This will set a flag to force creating a new Gen next time the store is locked (i.e. In Notify)
+            contentStore.CreateSnapshot();
+
+            Assert.IsFalse(contentStore.Test.NextGen);
+
+            _snapshotService.Notify(new[]
+            {
+                new ContentCacheRefresher.JsonPayload(1, Guid.Empty, TreeChangeTypes.RefreshNode)
+            }, out _, out _);
+
+            Assert.AreEqual(2, contentStore.Test.LiveGen);
+            Assert.IsTrue(contentStore.Test.NextGen);
+
+            middleNode = contentStore.Test.GetValues(1)[0];
+            Assert.AreEqual(2, middleNode.gen);
+            AssertLinkedNode(middleNode.contentNode, 100, 2, 3, 20, 40);
+        }
+
         /// <summary>
         /// This addresses issue: https://github.com/umbraco/Umbraco-CMS/issues/6698
         /// </summary>


Downgraded cherry picked test to work on 8.2.1

--- src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
+++ src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
@@ -1108,7 +1108,7 @@

             _snapshotService.Notify(new[]
             {
-                new ContentCacheRefresher.JsonPayload(1, Guid.Empty, TreeChangeTypes.RefreshNode)
+                new ContentCacheRefresher.JsonPayload(1,  TreeChangeTypes.RefreshNode)
             }, out _, out _);

             Assert.AreEqual(2, contentStore.Test.LiveGen);
@@ -1128,7 +1128,7 @@
         ///  2) Save and publish it
         ///  3) Publish it with descendants
         ///  4) Repeat steps 2 and 3
-        ///
+        ///
         /// Which has caused an exception. To replicate this test:
         ///  1) RefreshBranch with kits for a branch where the top most node is unpublished
         ///  2) RefreshBranch with kits for the branch where the top most node is published
@@ -1156,7 +1156,7 @@

                 //children of 1
                 yield return CreateInvariantKit(20, 1, 1, paths);
-                yield return CreateInvariantKit(30, 1, 2, paths);
+                yield return CreateInvariantKit(30, 1, 2, paths);
                 yield return CreateInvariantKit(40, 1, 3, paths);
             }

@@ -1183,7 +1183,7 @@

                 _snapshotService.Notify(new[]
                 {
-                    new ContentCacheRefresher.JsonPayload(1, Guid.Empty, changeType)
+                    new ContentCacheRefresher.JsonPayload(1, changeType)
                 }, out _, out _);

                 Assert.AreEqual(assertGen, contentStore.Test.LiveGen);
@@ -1193,12 +1193,12 @@
                 var (gen, contentNode) = contentStore.Test.GetValues(1)[0];
                 Assert.AreEqual(assertGen, gen);
                 //even when unpublishing/re-publishing/etc... the linked list is always maintained
-                AssertLinkedNode(contentNode, 100, 2, 3, 20, 40);
+                AssertLinkedNode(contentNode, 100, 2, 3, 20, 40);
             }

             //unpublish the root
             ChangePublishFlagOfRoot(false, 2, TreeChangeTypes.RefreshBranch);
-
+
             //publish the root (since it's not published, it will cause a RefreshBranch)
             ChangePublishFlagOfRoot(true, 3, TreeChangeTypes.RefreshBranch);


Let the default font be size 13

Let the default font be size 13

--- src/Xwt.Sdl/Xwt.SdlBackend/SdlFontBackendHandler.cs
+++ src/Xwt.Sdl/Xwt.SdlBackend/SdlFontBackendHandler.cs
@@ -46,7 +46,7 @@
 					return sysFont;

 				sysFont = FontWrapper.LoadFile ("/usr/share/fonts/TTF/SourceSansPro-Regular.ttf");
-				sysFont.FontSize = 11;
+				sysFont.FontSize = 13;
 				return sysFont;
 			}
 		}


Fixing merge issue

Fixing merge issue

--- src/Umbraco.Tests/Services/Importing/PackageImportTests.cs
+++ src/Umbraco.Tests/Services/Importing/PackageImportTests.cs
@@ -251,7 +251,6 @@
         private void AssertCheckBoxListTests(string strXml)
         {
             // Arrange
-            string strXml = ImportResources.CheckboxList_Content_Package;
             var xml = XElement.Parse(strXml);
             var dataTypeElement = xml.Descendants("DataTypes").First();
             var docTypesElement = xml.Descendants("DocumentTypes").First();


Added Role Constant

Added Role Constant

--- src/biz.dfch.CS.Abiquo.Client/v1/AbiquoRelations.cs
+++ src/biz.dfch.CS.Abiquo.Client/v1/AbiquoRelations.cs
@@ -19,6 +19,7 @@
     public static class AbiquoRelations
     {
         public const string ENTERPRISE = "enterprise";
+        public const string ROLE = "role";
         public const string USERS = "users";
         public const string VIRTUALMACHINETEMPLATE = "virtualmachinetemplate";


hide in print

hide in print

--- Snittlistan.Web/Areas/V2/Views/Roster/DisplayTemplates/Players.cshtml
+++ Snittlistan.Web/Areas/V2/Views/Roster/DisplayTemplates/Players.cshtml
@@ -69,7 +69,7 @@
                 })
         }
     }
-    @if (User.IsInRole2(WebsiteRoles.Uk.UkTasks))
+    @if (User.IsInRole2(WebsiteRoles.Uk.UkTasks) && hideControls == false)
     {
         @Html.ActionLink(
             "Händelser",


Formatting

Formatting

--- Source/ChromeCast.Desktop.AudioStreamer/Streaming/LoopbackRecorder.cs
+++ Source/ChromeCast.Desktop.AudioStreamer/Streaming/LoopbackRecorder.cs
@@ -165,20 +165,21 @@

             try
             {
-                if(recordingDevice.DataFlow == DataFlow.Render)
+                if (recordingDevice.DataFlow == DataFlow.Render)
                 {
                     soundIn = new CSCore.SoundIn.WasapiLoopbackCapture
                     {
                         Device = recordingDevice
                     };
-                } else
+                }
+                else
                 {
                     soundIn = new CSCore.SoundIn.WasapiCapture
                     {
                         Device = recordingDevice
                     };
                 }
-
+

                 soundIn.Initialize();
                 soundInSource = new SoundInSource(soundIn) { FillWithZeros = false };
@@ -268,7 +269,7 @@
                 isRecording = false;
             }
         }
-
+
         /// <summary>
         /// Start a timer that checks for silence (nothing recorded).
         /// </summary>


Fix SharpDX.MediaFoundation

Fix SharpDX.MediaFoundation

--- Source/SharpDX.MediaFoundation/DirectX/Hand.Generated/LocalInterop.cs
+++ Source/SharpDX.MediaFoundation/DirectX/Hand.Generated/LocalInterop.cs
@@ -140,7 +140,7 @@
         public static unsafe int Calliint(void* thisObject, int arg0, float arg1, float arg2, void* arg3, void* arg4, void* methodPtr) { throw new NotImplementedException(); }
       //  public static unsafe int Calliint(void* thisObject, int arg0, void* arg1, void* arg2, void* arg3, void* arg4, void* methodPtr) { throw new NotImplementedException(); }
         public static unsafe int Calliint(void* thisObject, System.Guid arg0, void* arg1, int arg2, void* arg3, void* arg4, void* methodPtr) { throw new NotImplementedException(); }
-        public static unsafe int Calliint(void* thisObject, System.Guid arg0, void* methodPtr) { throw new NotImplementedException(); }
+        //public static unsafe int Calliint(void* thisObject, System.Guid arg0, void* methodPtr) { throw new NotImplementedException(); }
         public static unsafe int Calliint(void* thisObject, int arg0, int arg1, int arg2, int arg3, void* methodPtr) { throw new NotImplementedException(); }
         public static unsafe int Calliint(void* thisObject, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, void* methodPtr) { throw new NotImplementedException(); }
         public static unsafe int Calliint(void* thisObject, void* arg0, void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6, void* arg7, void* methodPtr) { throw new NotImplementedException(); }


Fix int rounding error

Fix int rounding error

--- UnityProject/Assets/Scripts/Tilemaps/Behaviours/Layers/MetaTileMap.cs
+++ UnityProject/Assets/Scripts/Tilemaps/Behaviours/Layers/MetaTileMap.cs
@@ -485,9 +485,10 @@
 	{
 		var bounds = GetBounds();
 		//???
-		var min = CellToWorld( bounds.min ).RoundToInt();
-		var max = CellToWorld( bounds.max ).RoundToInt();
-		return new BoundsInt(min, max - min);
+		var min = CellToWorld(bounds.min);
+		var max = CellToWorld(bounds.max);
+
+		return new BoundsInt(min.RoundToInt(), (max - min).RoundToInt());
 	}

 	public BoundsInt GetBounds()


Added stats interfaces to Iunit and main unit object

--- Engine/Engine/Unit/Unit.cs
+++ Engine/Engine/Unit/Unit.cs
@@ -14,7 +14,8 @@
     {
         void attack(IUnit attackedBy);
         bool give_weapon(IWeapon newWeapon);
-        Stats get_stats();
+        IStatsReader get_stats_reader();
+        IStatsUpdater get_stats_updater();
         IWeapon get_weapon();
         IMoveable<TwoD> get_movement();
     }
@@ -23,14 +24,15 @@

     public class Unit : IUnit
     {
-        Stats stats;
         IWeapon weapon;
         IMoveable<TwoD> movement;
+        IStatsUpdater _statsUpdater;
+        IStatsReader _statsReader;

-
-        public Unit(Stats stats, IWeapon weapon, IMoveable<TwoD> movementHandler)
+        public Unit(IStatsUpdater statsUpdater, IStatsReader statsReader, IWeapon weapon, IMoveable<TwoD> movementHandler)
         {
-            this.stats = stats;
+            _statsReader = statsReader;
+            _statsUpdater = statsUpdater;
             this.weapon = weapon;
             this.movement = movementHandler;
         }
@@ -53,11 +55,6 @@

         }

-        public Stats get_stats()
-        {
-            return this.stats;
-        }
-
         public IWeapon get_weapon()
         {
             return this.weapon;
@@ -67,5 +64,15 @@
         {
             return movement;
         }
+
+        public IStatsReader get_stats_reader()
+        {
+            return _statsReader;
+        }
+
+        public IStatsUpdater get_stats_updater()
+        {
+            return _statsUpdater;
+        }
     }
 }


remove unused function FindVisualChild

remove unused function FindVisualChild

this ended up not being needed

--- EseView/MainWindow.xaml.cs
+++ EseView/MainWindow.xaml.cs
@@ -331,27 +331,6 @@
             }
         }

-        private static T FindVisualChild<T>(DependencyObject obj) where T : DependencyObject
-        {
-            for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(obj); i++)
-            {
-                DependencyObject child = System.Windows.Media.VisualTreeHelper.GetChild(obj, i);
-                if (child != null)
-                {
-                    T childT = child as T;
-                    if (childT != null)
-                        return childT;
-                    else
-                    {
-                        T childOfChild = FindVisualChild<T>(child);
-                        if (childOfChild != null)
-                            return childOfChild;
-                    }
-                }
-            }
-            return null;
-        }
-
         private void Search_Click(object sender, RoutedEventArgs e)
         {
             Search();


Added PopValue(s) extensions on NameValueCollection.

--- WmcSoft.Core/Collections/Specialized/NameValueCollectionExtensions.cs
+++ WmcSoft.Core/Collections/Specialized/NameValueCollectionExtensions.cs
@@ -35,6 +35,8 @@
 {
     public static class NameValueCollectionExtensions
     {
+        #region GetValue(s)
+
         /// <summary>
         /// Gets the named value from the collection and convert it to the requested type, or returns a default value when missing.
         /// </summary>
@@ -112,5 +114,44 @@
             }
             return Enumerable.Empty<T>();
         }
+
+        #endregion
+
+        #region PopValue(s)
+
+        public static T PopValue<T>(this NameValueCollection self, string name) {
+            return self.PopValue(name, default(T));
+        }
+
+        public static T PopValue<T>(this NameValueCollection self, string name, T defaultValue) {
+            string value = self[name];
+            T result = (value != null)
+                ? (T)Convert.ChangeType(value, typeof(T))
+                : defaultValue;
+            self.Remove(name);
+            return result;
+        }
+
+        public static T PopValue<T>(this NameValueCollection self, string name, Func<T> defaultValue) {
+            string value = self[name];
+            T result = (value != null)
+                ? (T)Convert.ChangeType(value, typeof(T))
+                : defaultValue();
+            self.Remove(name);
+            return result;
+        }
+
+        public static IEnumerable<T> PopValues<T>(this NameValueCollection self, string name) {
+            var values = self.GetValues(name);
+            if (values == null || values.Length == 0)
+                yield break;
+            self.Remove(name);
+
+            for (int i = 0; i < values.Length; i++) {
+                yield return (T)Convert.ChangeType(values[i], typeof(T));
+            }
+        }
+
+        #endregion
     }
 }


Removing map method

Removing map method

--- src/AutoMapper/IObjectMapper.cs
+++ src/AutoMapper/IObjectMapper.cs
@@ -7,13 +7,6 @@
     /// </summary>
 	public interface IObjectMapper
 	{
-        /// <summary>
-        /// Performs a map
-        /// </summary>
-        /// <param name="context">Resolution context</param>
-        /// <returns>Mapped object</returns>
-        //object Map(ResolutionContext context);
-
         /// <summary>
         /// When true, the mapping engine will use this mapper as the strategy
         /// </summary>