|
Only in web sites, where it seems to be the "done thing" for some reason - the default files created for a C# web project don't include any namespaces.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
BillWoodruff wrote: I would ask Mads T. if I could
You could always try asking him on Twitter: @MadsTorgersen[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well, I do "cheap," but, I have never done "tweet," and, I swear, by the Hammer of King Ludd, never will.
Surely, a savant, like Thou, doesn't "tweet."
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
I’ve done it.
“Evil” is not utilizing the features and allowances of a language because someone who couldn’t hack being a programmer decides something isn’t “best practice”.
In short, if it compiles, ship it.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I have 12 sets of dll for multi purpose, when I deploy the particular dll and I get this error. Please help me on this!. Mine is a C# code
|
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
How do you expect us to work out what method is missing from code we can't see, given a return type only, and with no idea what your "12 sets of dll" actually are, or how you deployed tham?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You'd have to show the whole error. But basically it's telling you that it cannot find some code that you are trying to call.
|
|
|
|
|
|
|
Hi,
I am currently working on SHA256withRSA algorithm in Window Fomrs, C#. My main objective is to get signed signature of my encrypted SHA256withRSA string with my Custom Private Key String which I generated from an online tool. In order to do that, I came to know that it happens via RSACryptoServiceProvider . Now in order to complete my sign operation I have to get the RSAParameters of my private key. And when I trying it the only part that I am getting is Modulus and Exponent part of the string. But I want to extract all of the components (P, Q, DP, DQ, InverseQ, D).
So where I am stuck unable to do it for quite some time. this is my first time working with this encryption stuff. And not sure if I am following the right convention.
Thanks
|
|
|
|
|
With a "custom private key string", and "component extraction", and "first time working", I wouldn't trust you.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Gerry Schmitz,
Thanks for replying. I totally understand your concern. But at first I was following this link[^] and trying to understand all of the procedures.
As for my project, I would be getting a private key from the client (by adding some sort of certificate - which I don't know much about just yet, but that thing is in the future). so after getting that key I have to sign it with my SHA256withRSA string. And that's all I have to do for now.
|
|
|
|
|
|
Hi All,
I am using Microsoft azure storage account class in C# to upload a file to storage account in C#.
Does anyone know how can i share the uploaded file with multiple users through C# code.
|
|
|
|
|
|
In the past, I did most of my work with parallel objects using Rx, but that was made a bit cumbersome in the recent project. So I was following the code from Brian Lagunas, I made some tweaks to it to see how it all worked.
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace WpfAsynTaskAwait
{
public class MainViewModel:BindableBase
{
#region "ctor"
public MainViewModel()
{
Text = "1: Main UI thread on: " + Thread.CurrentThread.ManagedThreadId.ToString();
Task.Run(() => DoSomething(MethodCallback)).Await(CompletedCallback, ErrorCallback);
}
#endregion
async Task DoSomething(Action<string> methodCallback)
{
await Task.Delay(1500);
methodCallback?.Invoke("2: Task starts on thread: " + Thread.CurrentThread.ManagedThreadId.ToString());
await Task.Delay(1500);
methodCallback?.Invoke("3: Task runs on thread: " + Thread.CurrentThread.ManagedThreadId.ToString());
await Task.Delay(1500);
}
#region "Variables"
private string _text = "Default value";
public string Text
{
get { return _text; }
set
{
SetProperty(ref _text, value);
}
}
#endregion
#region "Callback methods"
private void CompletedCallback()
{
Text = "4: Method completed called from thread: " + Thread.CurrentThread.ManagedThreadId.ToString();
}
private void MethodCallback(string message)
{
Text = message + Environment.NewLine + "Task callback from thread: " + Thread.CurrentThread.ManagedThreadId.ToString();
}
private void ErrorCallback(Exception ex)
{
Text = ex.Message;
}
#endregion
}
public static class TaskExtensions
{
public async static void Await(this Task task, Action completedCallback, Action<Exception> errorCallback)
{
try
{
await task;
completedCallback?.Invoke();
}
catch (Exception ex)
{
errorCallback?.Invoke(ex);
}
}
}
}
I just found it rather confusing that the method MethodCallback was allowed to interact directly (update) via binding with a UI-bound element. And my DoSomething does not return a Task but still does not complain about the implementation. This just confuses me. Why am I allowed to interact via callbacks from a worker thread to a UI thread?
|
|
|
|
|
Aren't callbacks just executed on the main thread, instead of the invoking one?
> "Task callback from thread: " + Thread.CurrentThread.ManagedThreadId.ToString()
Aigt, Convert.ToString(Thread.CurrentThread.ManagedThreadId) to avoid a Null-exception. What did your logs say? And if updating directly, instead of binding, does it show the same result?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
It's WPF stuff with PRISM, so I don't really have access to the textbox in the GUI directly. But it says that the application changes the property Text from the background thread. The text is thus updated on the UI via the binding and INotifiedPropertyChange interaction.
|
|
|
|
|
If you modify a bound property in your view model from a non-UI thread, WPF automatically marshals the UI update changes for that property to the UI thread. It works for all scalar types, but not collections. You have to create your own collection type that does the marshalling.
|
|
|
|
|
Thank you for the answer Dave.
So I modified the code in the MethodCallback and got exactly what you said :
This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread.
Now I have some more research to go further.
The change in the code is just banal, Binding to a TextBox and Listview's itemssource directly will throw the exception:
public class MainViewModel:BindableBase
{
#region "ctor"
public MainViewModel()
{
Text = "1: Main UI thread on: " + Thread.CurrentThread.ManagedThreadId.ToString();
TextCollection.Add("1: Main UI thread on: " + Thread.CurrentThread.ManagedThreadId.ToString());
Task.Run(() => DoSomething(MethodCallback)).Await(CompletedCallback, ErrorCallback);
}
#endregion
async Task DoSomething(Action<string> methodCallback)
{
await Task.Delay(1500);
methodCallback?.Invoke("2: Task starts on thread: " + Thread.CurrentThread.ManagedThreadId.ToString());
TextCollection.Add("2,5: Task starts on thread: " + Thread.CurrentThread.ManagedThreadId.ToString());
await Task.Delay(1500);
methodCallback?.Invoke("3: Task runs on thread: " + Thread.CurrentThread.ManagedThreadId.ToString());
await Task.Delay(1500);
}
#region "Variables"
private ObservableCollection<string> _textCollection = new ObservableCollection<string>();
public ObservableCollection<string> TextCollection
{
get { return _textCollection; }
set { SetProperty(ref _textCollection, value); }
}
private string _text = "Default value";
public string Text
{
get { return _text; }
set
{
SetProperty(ref _text, value);
}
}
#endregion
#region "Callback methods"
private void CompletedCallback()
{
Text = "4: Method completed called from thread: " + Thread.CurrentThread.ManagedThreadId.ToString();
TextCollection.Add("4: Method completed called from thread: " + Thread.CurrentThread.ManagedThreadId.ToString());
}
private void MethodCallback(string message)
{
Text = message + Environment.NewLine + "Task callback from thread: " + Thread.CurrentThread.ManagedThreadId.ToString();
TextCollection.Add(message + Environment.NewLine + "Task callback from thread: " + Thread.CurrentThread.ManagedThreadId.ToString());
}
private void ErrorCallback(Exception ex)
{
Text = ex.Message;
}
#endregion
}
public static class TaskExtensions
{
public async static void Await(this Task task, Action completedCallback, Action<Exception> errorCallback)
{
try
{
await task;
completedCallback?.Invoke();
}
catch (Exception ex)
{
errorCallback?.Invoke(ex);
}
}
}
|
|
|
|
|
|
I like this. Not a lot of backbreaking coding work
Literally just added two lines of code and all works well.
private object _TextCollectionLock = new object();
public MainViewModel()
{
BindingOperations.EnableCollectionSynchronization(TextCollection, _TextCollectionLock);
...
}
|
|
|
|
|
|
Huh, I didn't know know about that.
That makes life a little easier.
|
|
|
|