- Watch -> $(exception).InnerException ...
- First time ext - break on any CLR ext
- DebugerDisplay vs ToString()
- Just my Code -> uncheck to troubleshoot timer tick
- Threads window
- Debuging > Smbols > MS Sym Serv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO.Pipes; | |
var httpHandler = new SocketsHttpHandler | |
{ | |
ConnectCallback = async (ctx, ct) => | |
{ | |
var pipeClientStream = new NamedPipeClientStream( | |
serverName: ".", | |
pipeName: "my-test-pipe", | |
PipeDirection.InOut, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Theory] | |
[XUnitJsonFileData("TestData/Some.json", typeof(SomeTestData))] | |
public void ShouldDoSth(SomeTestData data) {} | |
[TestMethod] | |
[DeploymentItem("TestData/Some.xml")] | |
[MsTestXmlFileData("Some.xml", "DataSet", "In1", "In2", "In3", "ExpectedOutput")] | |
public void ShouldDoSth(string in1, string in2, string in3, string output) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
namespace FooBar | |
{ | |
public interface IBuilder { } | |
public interface IBuilder<TBuildResult, TBuilder> : IBuilder | |
where TBuildResult : class, new() | |
where TBuilder : class, IBuilder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Program | |
{ | |
// https://docs.microsoft.com/en-us/archive/msdn-magazine/2019/november/csharp-iterating-with-async-enumerables-in-csharp-8 | |
public static async Task Main(string[] args) | |
{ | |
using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(300)); | |
/* | |
* Passing the token directly to the method is easier, but it doesn’t work when you’re handed an arbitrary IAsyncEnumerable<T> | |
* from some other source but still want to be able to request cancellation of everything that composes it. | |
* In corner-cases, it can also be advantageous to pass the token to GetAsyncEnumerator, as doing so avoids “burning in” the token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Serializable] | |
public class CustomException : Exception | |
{ | |
public CustomException() | |
{ | |
} | |
public CustomException(string message) : base(message) | |
{ | |
} | |
public CustomException(string message, Exception innerException) : base(message, innerException) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum state_type {IDLE, CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED}; | |
// the problem | |
assert(state == IDLE || state == DISCONNECTING || state == DISCONNECTED); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
MainAsync().Wait(); | |
} | |
static async Task MainAsync() | |
{ | |
CancellationTokenSource cts = new CancellationTokenSource(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto parse_int(std::string_view str) | |
-> std::expected<int, std::domain_error> | |
{ | |
int i; | |
std::stringstream ss; | |
ss << str; | |
ss >> i; | |
if(ss.fail()) | |
return std::make_unexpected( std::domain_error("value is not an integer") ); | |
return i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
var cts = new CancellationTokenSource(); | |
cts.CancelAfter(TimeSpan.FromSeconds(10)); | |
TestProducerConsumerViaBufferBlock(cts.Token); | |
TestProducerConsumerViaActionBlock(cts.Token); | |
TestParallelTransformViaTransformBlock(cts.Token); | |
} |
NewerOlder