io.streamwriter Can't write to text file after async task - vb.net

I'm running the following code in an asynchronus sub and it's failing on "Test 2" write to a text file. I've tried writing asynchronously and synchronously and it fails when trying to write after the line BoxFldr = Await BoxFldrMgr.GetInformationAsync(id). This code is in a recursive sub and the streamwriter open/close is done in the sub calling this. Any ideas?
BoxFldrMgr = BoxClient.FoldersManager
BoxFileMgr = BoxClient.FilesManager
Debug.Print("Test write 1")
Await objWriter.WriteLineAsync("Test 1")
Debug.Print("getting folder details")
BoxFldr = Await BoxFldrMgr.GetInformationAsync(id)
Debug.Print("Test write 2")
Await objWriter.WriteLineAsync("Test 2")
It's failing with this error:
A first chance exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll
A first chance exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll
A first chance exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Exception has been thrown by the target of an invocation.

Related

SignalR Issue with .Net Core 5.0 migration, app.UseSignalR -> app.UseEndpoints

I've migrated from Net core 3.1 to 5.0, but I'm not able to get signalR to connect after the update. I'm getting a 401 error whenever It tries to connect to the hub.
Error Log
2020-12-17 15:47:07.351 -08:00 [INF] AuthenticationScheme: Identity.Application was challenged.
2020-12-17 15:47:07.351 -08:00 [INF] Request finished HTTP/2 POST
https://blah.blah.org:5001/range/negotiate?negotiateVersion=1 text/plain;charset=UTF-8 0 - 401 0
- 4.4068ms
2020-12-17 15:47:12.355 -08:00 [INF] Request starting HTTP/2 POST
https://blah.blah.org:5001/range/negotiate?negotiateVersion=1 text/plain;charset=UTF-8 0
2020-12-17 15:47:12.355 -08:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
Configure function items in Startup.cs
app.UseRouting();
app.UseAuthorization();
app.UseAuthentication();
app.UseCookiePolicy();
app.UseStaticFiles();
app.UseSession();
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<Hubs.RangeHub>("/range");
});
javascript
connection = connection || new signalR.HubConnectionBuilder()
.withUrl("/range")
.configureLogging(signalR.LogLevel.Information)
.build();
async function start()
{
try
{
await connection.start();
console.log("SignalR Connected.");
} catch (err)
{
console.log(err);
setTimeout(start, 5000);
}
};
start();
The Hub is using the [Authorize] Attribute
[Authorize]
public class RangeHub : Hub
I'm also seeing a disturbing amount of exceptions in the debug output in visual studio when I run the app that could be contributing to the issue:
Exception thrown: 'System.IO.IOException' in System.Net.Security.dll
Exception thrown: 'System.IO.IOException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.IOException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.IOException' in System.Private.CoreLib.dll
Exception thrown: 'System.Net.Sockets.SocketException' in
Exception thrown: 'System.Net.Sockets.SocketException' in System.Private.CoreLib.dll
Exception thrown: 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' in Microsoft.CSharp.dll
Exception thrown: 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' in Microsoft.CSharp.dll
Exception thrown: 'System.Net.Sockets.SocketException' in
Exception thrown: 'System.Net.Sockets.SocketException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.AspNetCore.Routing.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Is anyone else running into this issue? I've spent a few days trying different things, but short of reverting back to core 3, I don't know what else to try.
-- UPDATE -- After a couple more days of playing around with it I tried reverting back to core 3.1, but left the change of app.UseSignalR to app.UseEndpoints that 5.0 enforces. It looks like that change is the main problem I'm having trouble getting around. It brings with it some authorization changes I'm unfamiliar with and can't find any information on:
app.UseRouting();
app.UseAuthorization();
app.UseAuthentication();
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<Hubs.RangeHub>("/range");
});
The change over from app.UseSignalR to those lines. This is only being used for managing user sessions. Can anyone point me in the right direction?
This has been a crappy week. The problem was that app.UseAuthorization(); and
app.UseAuthentication(); were in the wrong order. They needed to look like this:
app.UseAuthentication();
app.UseAuthorization();
Frustrating when the solution is that simple.

Exception thrown: 'System.Net.WebException' in System.dll in visual studio

I am using Visual Studio and dotnet version 4.6.1. My code is accepting data from Azure Event Hub. The code was working fine and it was receiving data from event hub but now I am getting multiple exceptions related to . I didn't make any changes in code. Yes, there is probability of setting changes in browsers. I am getting following exceptions. Please suggest me the solution.
Thanks in advance!
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in mscorlib.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in mscorlib.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in mscorlib.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in mscorlib.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in mscorlib.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in mscorlib.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in mscorlib.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in mscorlib.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in
Microsoft.WindowsAzure.Storage.dll
Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
The thread 0x3898 has exited with code 0 (0x0).
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
The thread 0xe54 has exited with code 0 (0x0).
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
The thread 0x3fcc has exited with code 0 (0x0).
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
The thread 0x2648 has exited with code 0 (0x0).
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
The thread 0x2e94 has exited with code 0 (0x0).
The thread 0x4564 has exited with code 0 (0x0).
Exception thrown: 'System.Net.Sockets.SocketException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.IO.IOException' in System.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
The thread 0x3f20 has exited with code 0 (0x0).
Exception thrown: 'Microsoft.ServiceBus.Messaging.Amqp.AmqpException' in Microsoft.ServiceBus.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
The thread 0x10d8 has exited with code 0 (0x0).
The thread 0x4738 has exited with code 0 (0x0).
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
The thread 0xf10 has exited with code 0 (0x0).
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
The thread 0x4584 has exited with code 0 (0x0).
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
The thread 0x3d58 has exited with code 0 (0x0).
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll
Exception thrown: 'System.ArgumentException' in mscorlib.dll

munit throw a specific exception

I am trying to throw a Filter Unaccepted Exception in munit to test my error handling but I am getting this error
org.mule.api.MessagingException: Failed to invoke throw-an.
at get_data_filter_unaccepted_exception-test.mock:throw-an{doc:name=Throw unaccepted Exception, exception-ref=#[new org.mule.api.routing.filter.FilterUnacceptedException()], whenCalling=.*:.*}(get_data_from_qcfc-test-suite.xml:316)
at appleFlow.munit:test{initialState=started, description=Test, ignore=false, abstract=false, id=MunitTestFlow$$EnhancerByMUNIT$$904837f0{get_data_filter_unaccepted_exception-test}}(get_data_from_qcfc-test-suite.xml:315)
Caused by: org.mule.api.expression.ExpressionRuntimeException: Execution of the expression "new org.mule.api.routing.filter.FilterUnacceptedException()" failed.
at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(MVELExpressionLanguage.java:232)
This is my throw an exception
<mock:when messageProcessor=".*:.*" doc:name="Mock API Token Web Service Call">
<mock:with-attributes>
<mock:with-attribute name="doc:name" whereValue="#['Get API Token']"/>
</mock:with-attributes>
<mock:then-return payload="#[getResource('api_token_success.xml').asString()]" mimeType="application/xml"/>
</mock:when>
I think it is because of my MEL statement
#[new org.mule.api.routing.filter.FilterUnacceptedException()]
You could use a groovy component to throw your exception like that
<scripting:component doc:name="Throw Exception">
<scripting:script engine="Groovy"><![CDATA[throw new org.mule.api.routing.filter.FilterUnacceptedException(); ]]></scripting:script>
</scripting:component>
Hope it helps.
/T
I don't see throw-an call in the snippet you pasted.
Anyways, No argument constructor for org.mule.api.routing.filter.FilterUnacceptedException is not public, try using #[new org.mule.api.routing.filter.FilterUnacceptedException('Some message')]

Getting "java.lang.UnsatisfiedLinkError was thrown" while opening pdf file in vb.net

I am developing an application in vb.net it was working perfectly fine until this error occurred. I have tried everything but its of no use. Please Help me
ERROR:
Server Error in '/CNS/pdf' Application.
Exception of type java.lang.UnsatisfiedLinkError was thrown.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: java.lang.UnsatisfiedLinkError: Exception of type
java.lang.UnsatisfiedLinkError was thrown.
Source Error:
Line 1165: CheckedByName = dr.GetString(1)
Line 1166: CheckedByDesig = dr.GetString(2)
Line 1167: Case 3
Line 1168: ApprovedByName = dr.GetString(1)
Line 1169: ApprovedByDesig = dr.GetString(2)
Source File: C:\Inetpub\wwwroot\CNS\pdf\PdfForms.aspx.vb Line: 1167
Stack Trace:
[UnsatisfiedLinkError: Exception of type java.lang.UnsatisfiedLinkError was
thrown.]
java.lang.ExceptionInInitializerError.checkAndThrowException(Throwable
thrown) +59
java.io.File..cctor() +246
[TypeInitializationException: The type initializer for "java.io.File" threw an
exception.]
java.io.FileOutputStream..ctor(String path) +28
pdf.PdfForms.ShowPO(String PONo) in
C:\Inetpub\wwwroot\CNS\pdf\PdfForms.aspx.vb:1167
pdf.PdfForms.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\CNS\pdf\PdfForms.aspx.vb:52
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

Biztalk 2013 <string xmlns='http://schemas.microsoft.com/2003/10/Serialization/'> was not expected

I have a BizTalk 2013 orchestration which I published as a WCF service. The orchestration has a Request-Response port accepting a string and returning an entity which I have defined in a schema.
When I try use the service and pass a string to it, I get the error
http://schemas.microsoft.com/2003/10/Serialization/'> was not expected.
Does anyone have any ideas how to fix this?
Thanks
Full error details below:
xlang/s engine event log entry: Uncaught exception (see the 'inner
exception' below) has suspended an instance of service
'CAA.POC.ESB.BizTalk.Orchestrations.RetrieveAllCases(c408d4a7-3795-f6c7-dc95-c02edfe00740)'.
The service instance will remain suspended until administratively
resumed or terminated. If resumed the instance will continue from its
last persisted state and may re-throw the same unexpected exception.
InstanceId: 6b9cbf6a-2a63-4401-b3a1-05a870da963c Shape name:
ConstructCases ShapeId: 189c5a7f-2306-49dc-bd07-8430e638ba45 Exception
thrown from: segment 1, progress 7 Inner exception: There is an error
in XML document (1, 2).
Exception type: InvalidOperationException Source: System.Xml Target Site: System.Object Deserialize(System.Xml.XmlReader,
System.String, System.Xml.Serialization.XmlDeserializationEvents) The
following is a stack trace that identifies the location where the
exception occured
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader
textReader) at Microsoft.XLANGs.Core.Value.GetObject(Type t) at
Microsoft.XLANGs.Core.Value.RetrieveAs(Type t) at
Microsoft.XLANGs.Core.Part.ProtectedRetrieveAs(Type t) at
Microsoft.XLANGs.Core.Part.RetrieveAs(Type t) at
CAA.POC.ESB.BizTalk.Orchestrations.System_String.get_TypedValue()
at
CAA.POC.ESB.BizTalk.Orchestrations.RetrieveAllCases.segment1(StopConditions
stopOn) at
Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
StopConditions stopCond, Exception& exp) Additional error information:
<string xmlns='http://schemas.microsoft.com/2003/10/Serialization/'> was not
expected.
Exception type: InvalidOperationException Source: System.Xml Target Site: System.Object Read_string() The following is a stack
trace that identifies the location where the exception occured
at
System.Xml.Serialization.XmlSerializationPrimitiveReader.Read_string()
at
System.Xml.Serialization.XmlSerializer.DeserializePrimitive(XmlReader
xmlReader, XmlDeserializationEvents events) at
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, String encodingStyle, XmlDeserializationEvents events)