c#,windows-phone-8.1,async-await,.net-4.5
Why your code for ConvertToBase64 isn't being awaited? This is completely wrong, as the async void construction. Try to change your code to something like this: newOffer.photoBase64 = await SetPhotoString(Photo);//this line throws an excp. public async Task<string> SetPhotoString(BitmapImage bi) { return await bi.ConvertToBase64(); } Also, what line of the ConvertToBase64...
The hot fix for 4.5 is available here : kb2803754 And we need to contact the Microsoft support to get the hot fix installation file. MSDN thread for KB2803754 in .NET 4.5.1 framwork...
.net,batch-file,command-line,.net-4.5
There is also a windows CMD command called convert. Make sure that ImageMagick is infact accessable to your application through environment variable PATH or maybe directly specifying your ImageMagick/convert executable path in your batchfile. so in short i suspect your application is calling CMD convert (converting filesystem) instead of ImageMagick/convert...
c#,asp.net-mvc,asp.net-web-api,.net-4.5,c#-5.0
"await" essentially means that you are making the runtime to wait until the method is executed. The first code snippet returns a task object while the second returns the actual services from db. Since you are saying that with first code block it displays the services you must be awaiting...
What am I doing wrong? You're combining the constructor and initialization syntax, which is overwriting the .Path property completely, not appending to it. Essentially... var uriBuilder = new UriBuilder("D:\\Test"); // uriBuilder.Path is now "D:\\Test" // ToString() will give "file:///D:/Test" uriBuilder.Path = "locations"; // ToString() will give "file://locations", because Path...
To extract information from an expression it is recommend to use a custom visitor. The following visitor will return "Id = 1" when you execute it with your expression : Public Class WhereVisitor Inherits ExpressionVisitor Public Shared Function Stringify(expression As Expression) As String Dim visitor As New WhereVisitor() visitor.Visit(expression) Return...
Yes. You will need to create a class that acts as an intermediary for the WCF service client calls and then either loads an actual client or your mock service depending on some value (probably a config value). This way, the dependencies in your code are handled such that all...
You could replace the inner ListBox with an ItemsControl. Based on your question it sounds like you just need to display a collection, and prevent the user from interacting with it. A simple ItemsControl is well suited for that. The ItemsControl does not support selection, so the click will get...
c#,.net,multithreading,.net-4.5
You probably don't need to use the Thread class, it is quite low level and difficult to combine separate asynchronous operations together. Task APIs are much easier to use and combine multiple asynchronous operations together, they also support cancellation and have language support through the async and await keywords which...
c#,.net,task-parallel-library,async-await,.net-4.5
Of course, simply invoke the func, get back a task, and await it: async Task Method(Func<Task<Entity>> func) { // some code var a = await func(); // some code } Also, when you're sending that lambda expression, since all it's doing is calling an async method which in itself returns...
c#,visual-studio-2012,.net-4.5,32bit-64bit,anycpu
You are misinterpreting CorFlags I think. Here is a CorFlags truth table: CPU Architecture PE 32BITREQ 32BITPREF ------------------------ ----- -------- --------- x86 (32-bit) PE32 1 0 x64 (64-bit) PE32+ 0 0 Any CPU PE32 0 0 Any CPU 32-Bit Preferred PE32 0 1 As you can see, it will only...
c#,json,gridview,serialization,.net-4.5
You're binding the container object, not the list itself. Change it to: GridView1.DataSource = personDetail.PersonDetails; And it should work....
c#,.net,timer,.net-4.0,.net-4.5
TimeOut.InfiniteTimeSpan in TimeOut class is defined as: public static readonly TimeSpan InfiniteTimeSpan = new TimeSpan(0, 0, 0, 0, Timeout.Infinite); Where Timeout.Infinite is set to -1,so it is passing -1 value for milliseconds part. You can do: TimeSpan InfiniteTimeSpan = new TimeSpan(0, 0, 0, 0, -1); ...
c#,reference,.net-3.5,comparison,.net-4.5
Your previous code was broken, basically. You say it worked, but I can't see that the condition would ever be false. I suspect the compiler is just smarter now than it was before. The condition was: typedSender.InputHitTest(e.GetPosition(typedSender)) != typedSender.GetType() Now InputHitTest returns a value of type IInputElement. So the condition...
here is my tested solution for EXIF/MakerNote creation As far as I have read 37500 is the makernote hexdecimal tag inside EXIF. http://nicholasarmstrong.com/2010/02/exif-quick-reference/ public void CreateMakerNoteJpgImage(byte[] makerNoteArray, string path) { BitmapPalette myPalette = BitmapPalettes.WebPalette; // Creates a new empty image with the pre-defined palette BitmapSource image = BitmapSource.Create( Width, Height,...
asp.net-mvc-4,visual-studio-2013,typescript,.net-4.5
I had the same problem. Only way I found it just create a new folder '1.4' at C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.4 and copy to 'C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.4**1.4**' all files from parent directory. Stupid solution, but it works for me....
c#,.net,expression,.net-4.5,expression-trees
Problem with your code is that you have two instances of x parameter. One of them is private static field that is used across expression generation, and second one is that you create and use in Lambda creation. If you have ParameterExpression, then you should use the same instance in...
Looks like the BinaryWriter class forces excessive Flushing and there's no way to override it. I'll just keep a reference to the original stream and check position on it directly. I found the (alleged) source code here: http://reflector.webtropy.com/default.aspx/[email protected]/[email protected]/DEVDIV_TFS/Dev10/Releases/RTMRel/ndp/clr/src/BCL/System/IO/[email protected]/1305376/[email protected] /* * Returns the stream associate with the writer. It flushes all...
You can do it with a little extension method I found here Just put this into an extension class. public static KeyValuePair<TKey, TValue> GetEntry<TKey, TValue> (this IDictionary<TKey, TValue> dictionary, TKey key) { return new KeyValuePair<TKey, TValue>(key, dictionary[key]); } And then you can just set your item like this comboBox1.SelectedItem =...
c#,.net,multithreading,.net-4.5,httpresponse
The effect you are seeing may be related to SycnhronizationContext used by ASP.NET. Depending on .NET version and whether your code executes under ASP.NET page or something else, the behavior may change. Generally, it is normal for the SynchronizationContext to execute the callback on the same thread which started the...
c#,entity-framework,dependency-injection,ninject,.net-4.5
Probably you are not sharing the same DBContext Between GetTransactionDetails and AddAuthoritzation. Due to this reason Entity Framework is not able to track the changes. Set the scope life of DBContext for web request, you can do it with Ninject with .InRequestScope() https://github.com/ninject/ninject/wiki/Object-Scopes , with this option the same DBContext...
c#,task-parallel-library,async-await,.net-4.5,c#-5.0
No, because in fact you're sleeping for 7 seconds before you print Waiting started. Here's what happens: Main calls ProcessNumber ProcessNumber sleeps for 1 second ProcessNumber calls IncrementNumber IncrementNumber sleeps for 6 seconds IncrementNumber performs a computation, then returns a completed task ProcessNumber awaits that completed task, and continues ProcessNumber...
c#,multithreading,asynchronous,task,.net-4.5
The Progress<T> class uses a SynchronizationContext to invoke the reporting handler in an asynchronous manner. This is done to update the UI on the UI thread in WPF or WinForms. If that's not what you want (and it obviously isn't needed in your Console application), don't use the IProgress<T> interface...
asp.net,.net-4.5,asp.net-web-api2
The way we handle this is to use a separate config for connection strings, which is excluded from the repository. In Web.Config, the connection strings section looks like this: <connectionStrings configSource="Config\ConnectionStrings.config" /> The config folder has two files: ConnectionStrings.Config ConnectionStrings.Config.Template The template file consists of this: <connectionStrings> <add name="ConnectionString" connectionString="[...]"...
You should check agains the active directory, to be sure wether a user really exists. When you only check the local computer, only users which has logged in to the computer will be returned. If you don't want to use an additional assembly (which will be recommended) you can use...
c#,async-await,.net-4.5,dotnet-httpclient
You're executing this from a console application, which will terminate after your call to send. You'll have to use Wait or Result on it in order for Main not to terminate: private static void Main(string[] args) { var sendResult = send(options.FileName, options.Url).Result; Console.WriteLine(sendResult); } Note - this should be only...
You can use Expression<Func<T>> to do what you want. Define this method: private string ToPropertyName<T>(Expression<Func<T>> @this) { var @return = string.Empty; if (@this != null) { var memberExpression = @this.Body as MemberExpression; if (memberExpression != null) { @return = memberExpression.Member.Name; } } return @return; } Then you can write this:...
You could forgo the XmlReader and use a TextReader instead and use the TextReader XmlSerializer.Deserialize Method overload. Working example: void Main() { String aciResponseData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><tag><bar>test</bar></tag>"; using(TextReader sr = new StringReader(aciResponseData)) { var serializer = new System.Xml.Serialization.XmlSerializer(typeof(MyClass)); MyClass response = (MyClass)serializer.Deserialize(sr); Console.WriteLine(response.bar); } }...
Compile-time constants are checked differently to other code, basically. A cast of a compile-time constant into a type whose range doesn't include that value will always fail unless you explicitly have an unchecked expression. The cast is evaluated at compile time. However, the cast of an expression which is classified...
c#,winforms,httpwebrequest,.net-4.5,httpwebresponse
The closest I can think of is using HttpClient and passing a HttpCompletionOption.ResponseHeadersRead, so you can start receiving the request once the headers are sent and later start processing the rest of the response: public async Task ProcessRequestAsync() { var httpClient = new HttpClient(); var response = await httpClient.GetAsync( url,...
No, it should not be avoided at all costs. Remember, Data is Data, UI is UI. For example, if you have code which does only UI stuff, then there is nothing wrong with having code behind. Anything that works with actual data, including working with the ViewModel should generally be...
Here we have problem with design of ContinueWith and TaskScheduler's properties Current and Default in these two versions of .Net In .Net 4.0 the TaskScheduler's Current and Default both has same value i.e. ThreadPoolTaskScheduler, which is ThreadPool's context scheduler and it's not the one that updates the UI i.e. SynchronizationContextTaskScheduler...
This is never going to work like you've assumed. During deserialization, XmlSerializer invokes the getter to retrieve a presumably empty List<T> instance, and then calls its Add(T item) method to fill it with deserialized objects. The documentation in MSDN, in particular, says: The XmlSerializer gives special treatment to classes that...
c#,.net,visual-studio-2013,.net-4.5
It looks like this VS bug: Weird Access Violation Exception Reported here: https://connect.microsoft.com/VisualStudio/feedback/details/911564/access-violation-exception-in-vs-hosting-process-when-debugging-application And assumingly fixed in this .NET release: http://www.microsoft.com/en-us/download/details.aspx?id=42642...
vb.net,dll,runtime-error,.net-4.5,windows64
It might be that you registered the 64-bit edition of the ActiveX but your project was set to x86 (32-bit). You can try the following test: Unregister both 32-bit and 64-bit versions of the Lite ActiveX regsvr32 [path here]\DebenuPDFLibrary64Lite.dll /u regsvr32 [path here]\DebenuPDFLibraryLite.dll /u Register only the 64-bit version of...
multithreading,design-patterns,parallel-processing,async-await,.net-4.5
I don't think Parallel.ForEach is obsolete. Ever since introducing the Task Parallel Library (TPL) with .NET 4, Microsoft has distinguished between "Data Parallelism" (e.g. Parallel.ForEach) and "Task Parallelism" (Task). From MSDN: "Data parallelism refers to scenarios in which the same operation is performed concurrently (that is, in parallel) on elements...
c#,.net,wpf,async-await,.net-4.5
You can achieve that with AsyncBridge. E.g. using (var asyncBridge = AsyncHelper.Wait) { asyncBridge.Run(DoWorkAsync()); } It works by installing a custom SynchronizationContext and using that to wait for the task whilst freeing the UI thread. Because it is using synchronization context rather than using the dispatcher directly it is essentially...
Thanks for the very useful code example. It made understanding your problem much easier. So, what's the answer? Well, I have a couple of suggestions. First, you're really going about the whole bitmap stuff the wrong way, by using the System.Drawing namespace, which is primarily designed to support Winforms. Hence...
c#,session,asp-classic,.net-4.5
I'd say: Start the text file processing in a separate thread, that way you won't have to consider things like the regular http request timeout (default 20 minutes) etc. Regarding feedback to the users, do you expect them to stick around for 20 hours looking at the browser? If not,...
You should find TextBox element and subscribe to event PreviewMouseUp. 1) Add DatePicker with Loaded event: <DatePicker Name="myDatePicker" Loaded="MyDatePicker_OnLoaded" /> 2) Find TextBox element (in the DatePicker type of the text box element is DatePickerTextBox) and subscribe to PreviewMouseUp: private void MyDatePicker_OnLoaded(object sender, RoutedEventArgs e) { var tb = (DatePickerTextBox)myDatePicker.Template.FindName("PART_TextBox",...
Set build action of images to content, use proper tags for your Uri, remove Relative URI. var uriString = bk1 ? @"ms-appx:/Assets/image1.png" : @"ms-appx:/Assets/image2.png"; k1.Background = new ImageBrush { ImageSource = new BitmapImage(new Uri(uriString)) }; ...
c#,string,.net-4.5,string-formatting
String.Format does not escape anything. It's the compiler, that processes \n, \t and other escape sequences in string literals into something else (that is, if you look at the binary, produced by compiler and search for your string, you will not find literal \ character followed by n there, but...
c#,.net,http,authorization,.net-4.5
What you are experiencing is normal, this is how the NTLM authentication scheme works. 1: C --> S GET ... 2: C <-- S 401 Unauthorized WWW-Authenticate: NTLM 3: C --> S GET ... Authorization: NTLM <base64-encoded type-1-message> 4: C <-- S 401 Unauthorized WWW-Authenticate: NTLM <base64-encoded type-2-message> 5: C...
c#,concurrency,task-parallel-library,.net-4.5
How do I accomplish this? You can do this by changing BoundingBox to a Task<BoundingBox> which will be completed in the future. public static ptsTin Load(String file) { // Essential Work ptsTin newTin = new ptsTin(); newTin.LoadPoints(file); newTin.LoadTriangles(file); // At this point I could return, but I want other...
c#,visual-studio-2013,.net-4.5
func.Target is null because this delegate doesn't have any instance which it is invoked on. You can try following code: Calls.Add(c => ExtraCall((int)func(c))); ...
c#,.net,redis,.net-4.5,stackexchange.redis
From your comments, the guid here seems to be the hash field sub-key. Fundamentally, it works fine; see: static void Main() { int i = new Random().Next(); Console.WriteLine("> {0}", i); Guid guid = Guid.NewGuid(); using (var muxer = ConnectionMultiplexer.Connect("127.0.0.1:6379")) { var db = muxer.GetDatabase(); db.KeyDelete("foo"); db.HashSet("foo", guid.ToByteArray(), i); } using...
If the rest of the URL is fixed, you could locate the id manually, and use string.Format and string.Join to insert the IDs into it: var urlString = string.Format( "http://www.GoodStuff.xxx/services/stu/query?where=1%3D1&text=&objectIds={0}&time=" , string.Join("%", ids) ); This will insert a %-separated list of ids from your code into the URL template....
You can have startDownload wait for the asynchronous file download through Application.DoEvents() like this: private bool downloadComplete = false; private void startDownload(Uri toDownload, string saveLocation) { string outputFile = Path.Combine(saveLocation, Path.GetFileName(toDownload.AbsolutePath)); WebClient client = new WebClient(); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);...
Yes, LogicalOperationStack should work with async-await and it is a bug that it doesn't. I've contacted the relevant developer at Microsoft and his response was this: "I wasn't aware of this, but it does seem broken. The copy-on-write logic is supposed to behave exactly as if we'd really created a...
c#,.net,asynchronous,.net-4.5,sqldatareader
I have tested this and I think the problem is here: dt1.Load(dr); if (dr.NextResult())//I can't access second table in results { dt2.Load(dr); } From what I can see the the call to Load automatically advances the SqlDataReader to the next record set, so your call to dr.NextResult() will return false....
c#,.net,.net-4.5,extension-methods
You could just make the receiver of EnableLazyLoading a generic type constrained to be an IBaseService. It's wordy, but ought to do the trick. public static TService EnableLazyLoading<TService, TEntity, TKey>(this TService service) where TService : IBaseService<TEntity, TKey> where TEntity : Entity<TKey> where TKey : struct { // do stuff return...
c#,textbox,.net-4.5,streamreader
string usersTXT = sr.ReadLine(); Reads exactly one line. So you are only checking if you match the first line in the file. You want File.ReadALlLines (which also disposes the stream correctly, which you aren't): if (File.ReadAllLines(usersPath).Contains(user_txt.Text)) { } That reads all the lines, enumerates them all checking if your line...
azure,visual-studio-2013,.net-4.5,azure-active-directory
No, Windows authentication depends on Kerberos (or NTLM), which needs an Active Directory domain to authenticate the user in. Azure Active Directory does not handle Kerberos tokens. You can have your users authenticate against ADFS using the Kerberos protocol and federate the security token in ACS....
The issue of versioning a Win32 DLL and a COM library is a very specific implementation detail that has little to do with which of the two approaches is most suitable for consumption by a .NET client. Versioning COM versioning relies on consistent application of prescribed practices. It is possible...
What you need is adapter pattern. You can create classes that implements your interface and use Foo & Bar in the background: interface IFooBar { string A { get; set; } string B { get; set; } } class FooAdapter : IFooBar { private readonly Foo _foo; public FooAdapter(Foo foo)...
Because optional arguments in C# are just syntactic sugar. The method definition in your case is void Store(string payload, bool swallowException) rather than void Store(string payload) Which obviously doesn't match the interface. The way default arguments work is that the compiler injects the default values into the call of the...
There should be no need for an asynchronous version of Send because Send is asynchronous. From MSDN Sending messages in Message Queuing is always an asynchronous operation. When you are sure the queue is open, you can continue to send messages without stopping to wait for a reply. Even for...
I don't think you really need regexen for this. Here's how I would do it: var withEndings = new HashSet<string>(); var withoutEndings = new HashSet<string>(); foreach (var s in input) if(char.IsLower(s[s.Length - 1])) withEndings.Add(s.Substring(0, s.Length - 1)); else withoutEndings.Add(s); var result = withEndings.Intersect(withoutEndings); ...
You'll have to specify that it is a relative URI by setting UriKind.Relative: var uri = new Uri(@"..\..\Assets\Images\Image001.jpeg", UriKind.Relative); That said, your BitmapFromUri method might be redundant (unless you have a reason to set BitmapCacheOption.OnLoad). You may probably as well use the BitmapImage constructor that takes an Uri parameter: previewImage.Source...
I have made similar investigation about 3 months ago a project with Angular 2 and and Singnalr. I hope, the web socket usage is not essential for your project. As you can see here one of the Xamarin developers stated, it is not working as System.Web.WebSocket is not implemented in...
c#,wpf,exception-handling,.net-4.5
If you run your code under debugger control, the debugger will always intercept exceptions before your catch block. The question is whether or not the debugger displays a message, and that depends on debugger settings. If the debugger handles an exception by displaying a message, it's then up to you...
c#,.net,selenium,.net-4.5,extension-methods
It's not directly possible to group extension methods like that. In the example driver.Wills.MainCustomer.SetTitle("Dr"); you can make Wills and MainCustomer methods that each return a specialized type. The next level (MainCustomer and SetTitle) of drilling in can then key off of those types. Search for "fluent style" to see what...
I ran the commands in this answer and it solved my problem: 1.devenv.exe /safemode 2.devenv.exe /resetskippkgs 3.devenv.exe /installvstemplates 4.devenv.exe /resetsettings 5.devenv.exe /resetuserdata...
I found a working implementation of bounty castle, this has a mockPSKServer and client and supports the desired cipher suite. https://github.com/bcgit/bc-csharp...
c#,.net,.net-4.5,code-generation,reflection.emit
There are a few problems. Firstly, your use of parameterName for Ldarga_S is incorrect, it should be (byte)0. Note that the byte cast is required to ensure you're calling the correct Emit() overload - Ldarga_S takes a byte parameter, but without the cast you're calling the overload with int as...
c#,windows-phone-8,windows-phone-8.1,.net-4.5
GeoCoordinate.GetDistanceTo() is found in System.Device.Location namespace. But windows 8.1 (Runtime apps) apps use Windows.Devices.Geolocation namespace where GetDistanceTo() method is not present. So you can calculate the distance yourself by using the Haversine formula. Here is the wikipedia Haversine page, you can know about the formula from there. You can use...
I had the same issue and found no other solution then replacing them e.g. by a extension. As far as i know there is no "direct" solution for this. public static string ReplaceUmlaute(this string s) { return s.Replace("ä", "ae").Replace("ö", "oe").Replace("ü", "ue").Replace("Ä", "AE").Replace("Ö", "OE").Replace("Ü", "UE"); } Result: int compareResult = String.Compare("jörg".ReplaceUmlaute(),...
FileInfo fi = new FileInfo(@"C:\temp\Addresses.txt") var ZipCodesAndCountryCodes = File.ReadLines(fi.FullName).Select(l => { var countrySubstr = l.Substring(1405,30); return new { ZipCode = l.Substring(1395, 5), CountryCode = string.IsNullOrWhiteSpace(countrySubstr) || countrySubstr == "USA" || countrySubstr == "United States" || countrySubstr == "United States of America" ? "US" : countrySubstr }; }); ...
c#,visual-studio-2013,.net-4.5,wow64
I got that problem for a MySQL DataSource, that's because your DataSource is registered only for your current user, not Machine-wide. When the application is ran as an administrator, the program is looking in the machine wide data sources To register your DataSource System-Wide, open your Configuration Panel, in the...
.net,visual-studio-2012,.net-4.5,.net-assembly
Adding the loadFromRemoteSources switch to the machine.config file solved the problem.
Problem has been solved. On my machine was installed framework 4.5.2 but it was english language oriented version. From this place I found it out.This link helped me either. My application is russian language oriented, so I had to install framework 4.5.2 special for russian language. That's why I downloaded...
I think if call myTimer.Stop() or myTimer.Enable = false, the Tick method will run to the end but there won't be the next Tick. Correct. Stopping the timer will not kill the thread executing the callback function. Your Tick method will continue to run until it returns. You can...
I can't comment, because I don't have enough reputation yet. The RibbonTabHeader has the following properties: CheckedBackground - Gets or sets the brush that is used to draw the background of the control when it is in the Checked state. FocusedBackground - Gets or sets the brush that is used...
Easy peasy with a couple of DataTriggers: <Grid x:Name="LayoutRoot"> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <ListBox Grid.Row="0" ItemsSource="{Binding Currencies}" SelectedItem="{Binding SelectedCurrency, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" /> <TextBlock FontSize="30" Grid.Row="1"> <TextBlock.Style> <Style TargetType="TextBlock"> <Setter Property="Text" Value="{Binding Price,...
c#,.net,generics,.net-4.5,extension-methods
What is the base class of Universe.SolarSystemCelestial? Its something to do with the return type either being in a different assembly, or one of its base types, or types that it exposes publicly is in the other assembly. EDIT: After reading the question again with extra comments, the problem is...
In order to set the version you'll have to create an instance of HttpRequestMessage and set its Version property which you pass to HttpClient.SendAsync. You can use the helper HttpVersion utility class: var requestMessage = new HttpRequestMessage(); requestMessage.Version = HttpVersion.Version10; var client = new HttpClient(); var response = await client.SendAsync(requestMessage);...
asp.net,wcf,.net-4.5,web-api,asp.net-web-api2
The ServiceBehaviorAttribute is in the System.ServiceModel namespace and is used exclusively for WCF not for Web API. The following link seems to address your issue: Programmatically set InstanceContextMode
c#,html,.net-4.5,html-agility-pack
for this particular problem you could do simple regex replacing: string wrong = "<table class=\"transparent\"><tr><td>Sąrašo eil. Nr.:</td><td>B-FA001</td></tr><td>Įrašymo į Sąrašą data:</td><td>2006-11-13</td></tr></table>"; Regex reg = new Regex(@"(?<!(?:<tr>)|(?:</td>))<td>"); string right = reg.Replace(wrong, "<tr><td>"); Console.WriteLine(right); ...
c#,.net,queue,async-await,.net-4.5
There are many possible designs for this. But I always prefer TPL Dataflow. You can use an ActionBlock and post async delegates into it to be processed sequentially: ActionBlock<Func<Task>> _block = new ActionBlock<Func<Task>>(action => action()); block.Post(async () => { await Task.Delay(1000); MessageBox.Show("bar"); }); Another possible solution would be to asynchronously...
web-services,iis-7.5,.net-4.5,windows-server-2008
Step 1: Enable Logging in IIS In Order to enable better error messages and log files in IIS you must install two Features: Control Panel->Programs and Features->Turn Windows features on or off You'll need two features installed: WebServer->Common Http Features->HTTP Errors WebServer-> Health an Diagnostics->HTTP Logging Step 2: Analyse Error...
c#,linq,.net-4.5,anonymous-types
You are currently creating a list of anonymous types which have a single property, Info, that is a Dictionary<string, string>. You don't appear to be capturing the result in a variable. Then you try to access Info as if it were a single object outside of the RegEx query. Those...
I don't think the OS really 'knows' what kind (HDD/SDD) of drive you have. It might be possible to find out about RAID configurations through WMI but I'm not sure if that is reliable (some RAIDs are fully implemented in hardware). And even if you know about your drive, there...
I don't see why not: ` .NET Framework 4.5 is a high compatible in-place update that replaces .NET Framework 4 Source...
.net,garbage-collection,.net-4.5
Start with profiling. Find out what's giving you trouble and find a way to get rid of that. There's a few tweaks like using the multi-threaded GC, but that only really helps much for server applications with a few worker threads. Your best bet is to make sure most of...
c#,gzip,.net-4.5,dotnet-httpclient,winrt-async
As per the comments above, recreating the HttpClient is really the only (robust) way to do this. Manual decompression can be achieved but it seems to be very difficult to reliably/efficiently determine whether the content has been encoded or not, to determine whether to apply decoding.
c#,serialization,collections,.net-4.5
Your indexer will always loop indefinitely, regardless of whether you're using it in a serialization context or not. You probably want to call the base indexer inside it like this: public Section this[int index] { get { return (Section)base[index]; //loops here with index always [0] } set { base[index] =...
c#,multithreading,concurrency,.net-4.5,readerwriterlockslim
Why are the results so different when the only thing I’m changing is the ordering of the tasks within the list? My best guess is that Test #1 does not actually read items, as there is nothing to read. The order of task execution is: Read from shared pool...
c#,collections,tuples,.net-4.5
explanation of not working part :- it not working because you are intializtion your collection like this List<Tuple<byte, string>> intermediateResult = new List<Tuple<byte, string>>(); when you intialize like this than intermediateResult is not null. which is true....
Obviously duplicating the code is not a very good solution. A better approach is to define another DataTemplate as your common content and then use ContentPresenter to present it: <Window.Resources> <DataTemplate x:Key="CommonTemplate"> <TextBlock Text="{Binding CommonProperty1}" /> <TextBlock Text="{Binding CommonProperty2}" /> </DataTemplate> <DataTemplate x:Key="Template1" > <StackPanel> <ContentPresenter ContentTemplate="{StaticResource CommonTemplate}"/> <TextBlock Text="{Binding...
Using Task<T>.Result is the equivalent of Wait which will perform a synchronous block on the thread. Having async methods on the WebApi and then having all the callers synchronously blocking them effectively makes the WebApi method synchronous. Under load you will deadlock if the number of simultaneous Waits exceeds the...
If you want to do it in purely lambda: var match = categorys.Join(filterCategorys, x => x.Id, y => y.CategoryId, (x, y) => new { Id = x.Id }); var filteredList = categorys.Where(x => !match.Contains(new {Id = x.Id})); I haven't measured the performance of this, but for 70 records, optimization is...
javascript,wcf,internet-explorer-9,.net-4.5,xdomainrequest
Apparently, the problem came from a typo from the real source file (typo that doesn't appear here) The code that you see above works. I will leave my question here because it seems that it is the right way to proceed and if it doesn't function for you as it...
I was unable to figure out a way of doing it reliably with NPOI. The files created by the utility always came out corrupted. I switched over to EPPlus for xlsx. The resulting code looks like this: public void SetValue(int row, string column, string value) { row += 2; //EPPlus...