NullReferenceException from EWS Nuget - exchangewebservices

I am using Exchange.WebServices.Managed.Api 2.2.1.2 Nuget package to send email from EWS 2016.
Sometimes I am getting exception given below. Email is sent out and saved to Sent Items folder as well, so looks like this is not a server issue and seems like somehow Nuget package is throwing this misleading error.
Has anyone encountered this?
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.WrapStream(Stream responseStream, String contentEncoding)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetResponseStream(IEwsHttpWebResponse response)
at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponse(IEwsHttpWebResponse response)
at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute()
at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalCreateItems(IEnumerable`1 items, FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode, ServiceErrorHandling errorHandling)
at Microsoft.Exchange.WebServices.Data.ExchangeService.CreateItem(Item item, FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode)
at Microsoft.Exchange.WebServices.Data.Item.InternalCreate(FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode)
at Microsoft.Exchange.WebServices.Data.EmailMessage.InternalSend(FolderId parentFolderId, MessageDisposition messageDisposition)
at Microsoft.Exchange.WebServices.Data.EmailMessage.SendAndSaveCopy(WellKnownFolderName destinationFolderName)
at Elliott.CollateralMgmt.Common.Email.Emailer.SendEws(Email email, Boolean isHtml, Dictionary`2 attachments) in /app/Elliott.CollateralMgmt.Common/Email/Emailer.cs:line 162

For debugging such issues I recommend that you download the sources from:
https://github.com/OfficeDev/ews-managed-api
You will then be able to add breakpoint and step into the Library code
I your specific problem, you should take a look at
Microsoft.Exchange.WebServices.Data.ServiceRequestBase.WrapStream

I also encountered this with the nuget EWS 2.2.0 package. I found that I didn't hit this issue when referencing the git source https://github.com/OfficeDev/ews-managed-api instead of the nuget package for EWS 2.2.0 - depending on how you're using EWS, this might work for you.

Related

SSRS Migration from 2008R2 to 2017 Error RSPortal

I was migrating our reporting services from the version 2008R2 to the version 2017 restoring the db and all seems to work fine unless for some report for which I cannot open the subscriptions page.
For those report every time I enter in the report subscriptions page from the web view I get this error
"Something went wrong. Please try again later. "
If I go in the log from the RSPortal File I see this error:
ERROR: OData exception occurred: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.FormatException: The string was not recognized as a valid DateTime. There is an unknown word starting at index 18.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at Microsoft.ReportingServices.Portal.Services.ODataExtensions.ParameterValueExtensions.FormatAsISO8601Date(String date, String culture)
at Microsoft.ReportingServices.Portal.Services.ODataExtensions.ParameterValueExtensions.ToWebApiReportParameterValue(ParameterValue parameterValue, ReportParameterType reportParameterType, String culture)
at Microsoft.ReportingServices.Portal.Services.ODataExtensions.SubscriptionExtensions.ToReportPameterList(SubscriptionImpl librarySubscription, Dictionary`2 parameterTypes, String culture)
at Microsoft.ReportingServices.Portal.Services.ODataExtensions.SubscriptionExtensions.ToWebApiModel(SubscriptionImpl librarySubscription, Dictionary`2 parameterTypes, SubscriptionProperties properties)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
Does anyone have a suggestion on how to solve it? I thought was something related to the CultureInfo value but I am not sure.
Thanks
Probably could be helpful for someone in the future so I will indicate the steps I took to solve this issue:
This issue was due to a data type mismatching on one parameter for a few subscriptions.
Seems that the error handling has changed in the time with Microsoft in fact, after I found the subscriptions that were having problems I tried to open them in the old environment and I have got this error:
“The Value provided for the report parameter “YourDate’ is not valid for it is type (rsReportParameterTypeMismatch)”
What I did so was to delete these subscriptions with the error in the new Reporting Server environment and finally the web view worked fine

AnkhSVN crash in Visual Studio 2017

[W10 Pro x64 v1709, Visual Studio 2017 Community 15.6.0, AnkhSVN 2.7.12815.35086]
I am getting a crash at VS startup of AnkhSVN in VS 2017. I believe this just started happening today - I don't remember it happening the last time I opened the IDE. Uninstall/reinstall of the extension doesn't help. Error msg when I attempt to open the Pending Changes window:
AnkhSVN Exception
An internal error occurred:
Object reference not set to an instance of an object.
Stack trace:
System.NullReferenceException: Object reference not set to an instance of an object.
at Ankh.UI.PendingChanges.PendingChangesToolControl.OnLoad(EventArgs e)
at System.Windows.Forms.UserControl.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at Ankh.VSPackage.AnkhToolWindowPane.get_Window()
at Microsoft.VisualStudio.Shell.Package.ToolWindowCreationResult..ctor(WindowPane window, UInt32 flags)
at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, UInt32 flags, Object context, Guid persistenceGuid)
at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, Object context)
at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id)
at Microsoft.VisualStudio.Shell.Package.FindToolWindow(Type toolWindowType, Int32 id, Boolean create, ProvideToolWindowAttribute tool)
at Ankh.VSPackage.AnkhSvnPackage.ShowToolWindow(AnkhToolWindow toolWindow, Int32 id, Boolean create)
at Ankh.VSPackage.AnkhSvnPackage.ShowToolWindow(AnkhToolWindow window)
at Ankh.Commands.UI.ShowToolWindows.OnExecute(CommandEventArgs e)
at Ankh.Commands.CommandMapItem.OnExecute(CommandEventArgs e)
at Ankh.Commands.CommandMapper.Execute(AnkhCommand command, CommandEventArgs e)
Troubleshooting/repair suggestions?
This appears to be an issue introduced in the 15.6 release of Visual Studio 2017 - I see the same thing in Visual Studio 2017 Professional v15.6.
There is an open issue here: https://developercommunity.visualstudio.com/content/problem/207735/ankhsvn-2712815-failed-to-load-pending-changes-vie.html that is marked as under investigation. I see 58 people are following the issue, so hopefully it will get some traction and be fixed soon.
Microsoft released fixed VS 15.6.1
I just committed a fix. I think you can work around this issue by unchecking the checkbox to add all files in the initial commit in the dialog where you select the location. (This used to be the default some time ago)
This issue will be fixed in the next release, and I’ll try to get one out over the next two weeks. I think VS 2017 should update AnkhSvn automatically unless you explicitly disabled this yourself.
Source URL :- https://ankhsvn.open.collab.net/ds/viewMessage.do?dsForumId=582&dsMessageId=614598

Box API .NET SDK: "pad block corrupted" exception when instantiating BoxJWTAuth

I'm using the Box SDK for .NET and just trying to get started authenticating using the Java Web Token workflow. I'm using code that's pretty much the same as the code sample that's included in the SDK's code examples.
var jwtPrivateKey = File.ReadAllText("private_key.pem");
var boxConfig = new BoxConfig(ClientId, ClientSecret, EnterpriseId, jwtPrivateKey, JwtPrivateKeyPassword, JwtPublicKeyId);
var boxJwt = new BoxJWTAuth(boxConfig);
But at that last line I'm getting an exception that says "pad block corrupted". The stack trace seems to indicate that it involves reading the private key, but I don't see what I could be doing wrong considering this is basically the same as the code sample (https://github.com/box/box-windows-sdk-v2/blob/master/Box.V2.Samples.JWTAuth/Program.cs).
Any ideas?
After re-generating the private key with Cygwin, things are working for me.
I believe what happened was I opened the private key in Notepad or something, then saved it in some format it didn't like (maybe changed encoding to UTF-8, or saved it with Windows-style line breaks).

Unable to create new virtual directory in SSRS report manager

Trying to change URLs
from:
http://blah/ReportServer
to:
http://blah/ReportServer/Foo
Error:
Microsoft.ReportingServices.WmiProvider.WMIProviderException: The virtual directory specified is not valid. Make sure the specified name is not too long and doesn't contain illegal characters. (example: ;)
---> System.Runtime.InteropServices.COMException (0x8004020D): Cannot modify or delete an object that was not added using the COM+ Admin SDK (Exception from HRESULT: 0x8004020D)
--- End of inner exception stack trace ---
at Microsoft.ReportingServices.WmiProvider.RSWmiAdmin.ThrowOnError(ManagementBaseObject mo)
at Microsoft.ReportingServices.WmiProvider.RSWmiAdmin.SetVirtualDirectory(String application, String virtualDirectory)
at ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.SetVirtualDirectory(UrlApplication app, String virtualDirectory)
Changing to:
http://blah/ReportServer_Foo
works just fine. Not sure what's going on. Any information is appreciated.
Looks like its following the convention of SERVERNAME_INSTANCENAME used commonly with integrated authentication for example.

Microsoft.Web.Services3.ResponseProcessingException

I deployed a web service that used WSE 3.0 to a test server. I am getting the cryptic error below. Have any idea what this means and how to fix it? Thanks in advance!
Microsoft.Web.Services3.ResponseProcessingException: WSE910: An error happened during the processing of a response message, and you can find the error in the inner exception. You can also find the response message in the Response property. ---> System.Xml.XmlException: 'wsse' is an undeclared namespace. Line 1, position 97.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg, Int32 lineNo, Int32 linePos)
at System.Xml.XmlTextReaderImpl.LookupNamespace(NodeData node)
at System.Xml.XmlTextReaderImpl.ElementNamespaceLookup()
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at Microsoft.Web.Services3.Xml.XmlSkipDTDReader.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at Microsoft.Web.Services3.SoapEnvelope.Load(Stream inStream)
at Microsoft.Web.Services3.Xml.SoapEnvelopeReaderWrapper..ctor(SoapClientMessage message, String messageContentType)
--- End of inner exception stack trace ---
at Microsoft.Web.Services3.Xml.SoapEnvelopeReaderWrapper..ctor(SoapClientMessage message, String messageContentType)
at Microsoft.Web.Services3.WebServicesClientProtocol.GetReaderForMessage(SoapClientMessage message, Int32 bufferSize)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
I found a solution. Since the dll was working when I called it from a windows client but was failing when called from a web service I suspected that the problem might be permissions related. I set the web service to impersonate a user with sufficient permissions. See http://support.microsoft.com/kb/306158 for how to information. Now it works. Hope this helps someone else, Dan
System.Xml.XmlException: 'wsse' is an undeclared namespace. Line 1, position 97.
Well if this statement is true then you have the wrong namespace. Check out your solution files to make sure they're under the write ns'es.
I got the same problem and it was a problem of date time synchronization between the server and the client. After setting the same time in the client and server, the error was fixed.