does anyone know how to fix this exception?
An unhandled exception of type 'System.NotImplementedException' occurred in mscorlib.dll
I'm using .NET microframework 4.1 and I have the "mscorlib" reference added but when I try to load a BMP image from the resources:
internal static Microsoft.SPOT.Bitmap GetBitmap(Resources.BitmapResources id)
{
return Microsoft.SPOT.Bitmap(Microsoft.SPOT.ResourceUtility.GetObject(ResourceManager, id));
}
[System.SerializableAttribute()]
internal enum BitmapResources : short
{
image = 24837,
}
I get that exception in the return sentence.
Stack trace:
System.Resources.ResourceManager::GetObjectInternal\r\nSystem.Resources.ResourceManager::GetObjectFromId\r\nMicrosoft.SPOT.ResourceUtility::GetObject\r\nFEZTouchDriver_Example.Resources::GetBitmap\r\nFEZTouchDriver_Example.Program::InitGraphics\r\nFEZTouchDriver_Example.Program::Main\r\n" string
Related
When trying to deserialize an observablecollection, it gives me an exception
**"
"An exception of type 'System.NotSupportedException' occurred in protobuf-net.Core.dll but was not handled in user code
Additional information: A repeated type was not expected as an aux type:""**
public Task<T> ReceiveDataAsync<T>(TcpClient client)
{
using (NetworkStream stream = new NetworkStream(client.Client, false))
{
return Task.FromResult(Serializer.DeserializeWithLengthPrefix<T>(stream, PrefixStyle.Fixed32));
}
}
I haven't found details about this exception at all.
The WithLengthPrefix API expects a single message, not a collection. Maybe serialize something that has a collection.
I'm trying to handle Exception thrown inside ReactiveUI (7.4.0.0)'s commands, but everything seems to be swllowed somehwere inside and never comes out but in Visual Studio's Output window.
My test code is this:
class Program
{
static void Main(string[] args)
{
try
{
var ata = ReactiveCommand.CreateFromTask(async () => await AsyncTaskThrowException());
ata.ThrownExceptions.Subscribe(ex => Console.WriteLine($"async with await:\t{ex.Message}"));
ata.Execute();
// Exception thrown: 'System.InvalidOperationException' in System.Reactive.Windows.Threading.dll
// Exception thrown: 'System.Exception' in Test.exe
// Exception thrown: 'System.Exception' in mscorlib.dll
var atna = ReactiveCommand.CreateFromTask(() => AsyncTaskThrowException(),null, RxApp.MainThreadScheduler);
atna.ThrownExceptions.Subscribe(ex => Console.WriteLine($"async without await:\t{ex.Message}"));
atna.Execute();
// Exception thrown: 'System.InvalidOperationException' in System.Reactive.Windows.Threading.dll
// Exception thrown: 'System.Exception' in Test.exe
var ta = ReactiveCommand.CreateFromTask(async () => await TaskThrowException());
ta.ThrownExceptions.Subscribe(ex => Console.WriteLine($"async without await:\t{ex.Message}"));
ta.Execute();
// Exception thrown: 'System.InvalidOperationException' in System.Reactive.Windows.Threading.dll
// Exception thrown: 'System.Exception' in Test.exe
var tna = ReactiveCommand.CreateFromTask(() => TaskThrowException());
tna.ThrownExceptions.Subscribe(ex => Console.WriteLine($"async without await:\t{ex.Message}"));
tna.Execute();
// Exception thrown: 'System.InvalidOperationException' in System.Reactive.Windows.Threading.dll
// Exception thrown: 'System.Exception' in Test.exe
// Exception thrown: 'System.InvalidOperationException' in System.Reactive.Windows.Threading.dll
var sf = ReactiveCommand.Create(() => ThrowException());
sf.ThrownExceptions.Subscribe(ex => Console.WriteLine($"sync:\t{ex.Message}"));
sf.Execute();
// Exception thrown: 'System.InvalidOperationException' in System.Reactive.Windows.Threading.dll
}
catch (Exception ex)
{
Debug.WriteLine($"{nameof(ex.Message)}: {ex.Message}");
Debug.WriteLine($"{nameof(ex.StackTrace)}: {ex.StackTrace}");
}
Console.ReadLine();
}
static async Task<string> AsyncTaskThrowException()
{
await Task.Delay(100);
throw new Exception("Exception in async Task");
}
static Task<string> TaskThrowException()
{
throw new Exception("Exception in non-async Task");
}
static string ThrowException()
{
throw new Exception("Exception in sync func");
}
}
Under each call there are the Exception's thrown if I comment everything but that .Execute() call (intentional one included).
The only call that prints something is the third:
ReactiveCommand.CreateFromTask(() => TaskThrowException());
But still throws something.
Can you help me understand why the other Exceptions don't get piped into ThrownExceptions, and how to completely handle errors so they don't get logged in the Output window?
Thanks!
I am getting below Unhandled exception at the startup of my chatbot application in output window.
Exception thrown: 'System.UnauthorizedAccessException' in mscorlib.dll
Exception thrown: 'System.Globalization.CultureNotFoundException' in mscorlib.dll
Exception thrown: 'System.Security.SecurityException' in mscorlib.dll
Exception thrown: 'System.BadImageFormatException' in mscorlib.dll
Exception thrown: 'System.ArgumentNullException' in mscorlib.dll
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
I have something in my MessageController
public class MessagesController : ApiController
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private static DocumentClient client;
// Retrieve the desired database id (name) from the configuration file
private static readonly string databaseId = ConfigurationManager.AppSettings["DatabaseId"];
// Retrieve the desired collection id (name) from the configuration file
private static readonly string collectionId = ConfigurationManager.AppSettings["CollectionId"];
// Retrieve the DocumentDB URI from the configuration file
private static readonly string endpointUrl = ConfigurationManager.AppSettings["EndpointUri"];
// Retrieve the DocumentDB Authorization Key from the configuration file
private static readonly string authorizationKey = ConfigurationManager.AppSettings["PrimaryKey"];
/// <summary>
/// POST: api/Messages
/// Receive a message from a user and reply to it
/// </summary>
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
Trace.TraceInformation($"Type={activity.Type} Text={activity.Text}");
//disable the Application Insights and DocumentDb logging in local enviornment
#if (LOCAL)
Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.DisableTelemetry = true;
#endif
#if (!LOCAL)
if (!String.IsNullOrEmpty(endpointUrl) && !String.IsNullOrEmpty(authorizationKey))
{
using (client = new DocumentClient(new Uri(endpointUrl), authorizationKey))
{
await CaptureConversationData(activity);
}
}
#endif
if (activity.Type == ActivityTypes.Message)
{
//await Microsoft.Bot.Builder.Dialogs.Conversation.SendAsync(activity, () => new ContactOneDialog());
//Implementation of typing indication
//ConnectorClient connector = new ConnectorClient(new System.Uri(activity.ServiceUrl));
//Activity isTypingReply = activity.CreateReply("Shuttlebot is typing...");
//isTypingReply.Type = ActivityTypes.Typing;
//await connector.Conversations.ReplyToActivityAsync(isTypingReply);
logger.Debug("The User's local timeStamp is: " + activity.LocalTimestamp + "and service timeStamp is: " + activity.Timestamp);
await Conversation.SendAsync(activity, () =>
new ExceptionHandlerDialog<object>(new ShuttleBusDialog(), displayException: true));
}
else
{
HandleSystemMessage(activity);
}
var response = Request.CreateResponse(System.Net.HttpStatusCode.OK);
return response;
}
}
It thrown at first line
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
here is the snapshot,
One weired thing is that if my project run from C:\Users\\chatbot\Mybot..
then these exception are not getting thrown even i have put the break exception setting in exception setting window.
but if I move the project to c:\Sandy\MyStuff\ChatbOt\MyBot it's started throwing all these exception since i have put the break exception setting in exception setting window.
I am seriously not able to understand what is the problem.
Try running your visual studio as administrator or running your application as administrator, and check that all the Dlls that your project depends on are there in the new path.
I've started using the MongoDB .Net driver to connect a WPF application to a MongoDB database hosted on MongoLabs.
But the following method I created to load the connection(called on the MainViewModel's constructor), threw a timeout exception on the line marked in the method below.
I tried to resolve the error further by adding an exception check of type MongoException to no avail. Also checked that the connection string is valid as per the docs and it seems so: (password starred out for security)
private const string connectionString = "mongodb://<brianVarley>:<********>#ds048878.mongolab.com:48878/orders";
The specific error thrown is as follows:
An exception of type 'System.TimeoutException' occurred in mscorlib.dll
Complete Error Link: http://hastebin.com/funanodufa.tex
Does anyone know the reason why I'm getting the timeout on my connection method?
public List<Customer> LoadCustomers()
{
var client = new MongoClient(connectionString);
var database = client.GetDatabase("orders");
//Get a handle on the customers collection:
var collection = database.GetCollection<Customer>("customers");
try
{
//Timeout error thrown at this line:
customers = collection.Find(new BsonDocument()).ToListAsync().GetAwaiter().GetResult();
}
catch(MongoException ex)
{
//Log exception here:
MessageBox.Show("A handled exception just occurred: " + ex.Message, "Connection Exception", MessageBoxButton.OK, MessageBoxImage.Warning);
}
return customers;
}
Solved this error by re-editing my connection string. I had left these two symbols in my connection string in error, '<' and '>' between the user name and password credentials.
Correct format:
"mongodb://brianVarley:password#ds054118.mongolab.com:54118/orders";
Incorrect format:
"mongodb://<brianVarley>:<password;>#ds054118.mongolab.com:54118/orders";
I wanted to use Socketex.tcpclient from a nuGet library.
I added it this way:
When I want to use it in application
using Microsoft.Phone.Controls;
using System;
using System.Windows;
using System.Windows.Navigation;
using SocketEx;
using System.Threading;
namespace HomeSecurityClient {
public partial class MainPage : PhoneApplicationPage {
private string localIP, globalIP, port;
private Thread sendThread;
public MainPage() {
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e) {
base.OnNavigatedTo(e);
String args = null;
NavigationContext.QueryString.TryGetValue("ms_nfp_launchargs", out args);
if (args != null) {
MessageBox.Show(args);
string[] splittedArgs = args.Split(' ');
globalIP = splittedArgs[0];
port = splittedArgs[1];
localIP = splittedArgs[2];
makeSwitch();
sendThread = new Thread(new ThreadStart(makeSwitch));
sendThread.Start();
}
}
private void makeSwitch() {
TcpClient client = new TcpClient(localIP, Int32.Parse(port));//THIS CAUSES THIS MESSAGE
// client.Connect(localIP, Int32.Parse(port));
}
}
}
Just after I accept message box and method makeSwitch is invoked I get:
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{39989B95-A54A-4810-B4EE-35B33265A680}\Install\socketex.tcpclient.DLL'. Cannot find or open the PDB file.
param=89.77.153.205
13000
192.168.0.13
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll
param=89.77.153.205
13000
192.168.0.13
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll
The thread 0x38 has exited with code 259 (0x103).
How to fix that?