I'm trying to write a c# unit test and get an error that can't set data for Request.Headers
Error message: Operation is not supported on this platform
How to do when using .Net 3.0
Related
I am working on creating a workflow which allows composer created dialogs to be integrated into a bot skill project.
To accomplish this I am trying to follow the instructions in this post: https://microsoft.github.io/botframework-solutions/skills/handbook/experimental-add-composer/
My composer created dialogs including calling a skill. When I initiate that intent through the Bot Emulator I get this error:
System.NullReferenceException: 'Unable to locate SkillConversationIdFactoryBase in HostContext'
The setup to get to this error is time consuming so I have created a git repo which can be started fairly easily to demonstrate the issue.
The project can be found here:
https://github.com/silverbulletgt/Integrate-Composer-Dialog-Using-Skill
To recreate the issue:
Prerequisites
Install Bot Emulator: https://github.com/Microsoft/BotFramework-Emulator/blob/master/README.md
Step to Recreate the Issue
Open the solution file in visual studio
Integrate-Composer-Dialog-Using-Skill.sln
Put a breakpoint on line 72 of DefaultAdapter.cs - this is where the error can be seen
Start debugging the project
Open Bot Emulator
Connect to the bot: http://localhost:3978/api/messages
Type "Greeting"
Bot should respond with "Hello, I have recognized that you said greeting" - This means that the composer dialog integration is working as expected.
Type "Skill"
The breakpoint on line 72 of DefaultAdapter.cs should trigger giving details of the error.
Error & stack trace can be found here: https://github.com/silverbulletgt/Integrate-Composer-Dialog-Using-Skill/blob/master/Readme/error%20stack%20trace.txt
Edit:
I was able to compile the Bot Builder code Bot Builder GitHub & connect it to my project so that I could debug. I found the error to be happening on line 157 of Microsoft.Bot.Builder.Dialogs.Adaptive.BeginSkill.cs code BeginSkill.cs.
This line is trying to get the SkillConversationFactoryBase out of the dialogContext.Context.TurnState. I'm investigating how I might add this so that it is populated when this code executes.
Fix: System.NullReferenceException: 'Unable to locate SkillConversationIdFactoryBase in HostContext' in Microsoft.Bot.Builder.Dialogs.Adaptive.Actions.BeginSkill
This error was being caused by missing dependency injection requirements.
Added the below lines to Startup.cs
services.AddSingleton<SkillConversationIdFactoryBase, SkillConversationIdFactory>();
services.AddSingleton<HttpClient>(new HttpClient());
services.AddSingleton<BotFrameworkClient, BotFrameworkHttpClient>();
Added to DefaultAdapter.cs
New Field
private readonly SkillConversationIdFactoryBase _skillConversationIdFactoryBase;
New constructor parameters
SkillConversationIdFactoryBase skillConversationIdFactoryBase,
BotFrameworkClient botFrameworkClient
To the body of the constructor
_skillConversationIdFactoryBase = skillConversationIdFactoryBase;
Use(new RegisterClassMiddleware<SkillConversationIdFactoryBase>(_skillConversationIdFactoryBase));
Use(new RegisterClassMiddleware<BotFrameworkClient>(botFrameworkClient));
This fixed the initial exception however there was then a new exception when the skill was called.
Exception wasOperation returned an invalid status code 'NotFound'
at Microsoft.Bot.Connector.Conversations.d__10.MoveNext()
Fixing Operation returned an invalid status code 'NotFound'
This exception was occurring because there was no endpiont api/skills. I suppose that the Bot Composer adds this endpoint automatically somehow.
I added SkillController.cs based on the example here: Bot Builder Tests JSON SkillController
Then added dependency injection to support the controller.
Added to Startup.cs
services.AddSingleton<ChannelServiceHandler, SkillHandler>();
services.AddSingleton<BotAdapter>(sp => (BotFrameworkHttpAdapter)sp.GetService<IBotFrameworkHttpAdapter>());
I tested a basic intent which does not use a skill to determine if there would be any conflict with the dependency injection impacting those. The basic intent worked as expected though.
I updated the master branch with the changes Project Repo
I have configured my selenium tests in C# to report logs using Extent Reports and wanted to try the ExtentX version using MongoDB. I have set up ExtentX and MongoDB and they are running but the test fails with the following error...
"ArgumentNullException was unhandled by user code, value cannot be null" at the following line in the teardown...
extent.EndTest(test);
I am specifying the mongo connection string via...
extent = new ExtentReports(reportPath, true); // create instance
extent.X("mongodb://localhost:27017");
The test runs fine when not specifying the mongo connection. Any help is much appreciated.
Figured it out. I needed to add AssignProject("") to the extent. Now it works and the ExtentX reports are populated. There is missing data but that's another issue.
I am trying to use the linq2db library (thanks by the way!) to retrieve records from an Informix database. I followed the steps from the documentation and was able to successfully get records from an ASP.NET console applicaiton using the Visual Studio debugger. However, I then tried to follow the same with a fresh and standalone ASP.NET MVC5 application and I am getting the error "The type initializer for 'IBM.Data.Informix.IfxDecimal' threw an exception." also running using Visual Studio debugger. I did some digging by downloading the source code and adding some break points and found that Line 125 and line 133 of the file LinqToDB.DataProvider.Informix.InformixDataProvider file are involved in causing the error. But that is as far as I got. So running in the context of a web application throws an error, but running in a console application is fine.
below is line 125 of LinqToDB.DataProvider.Informix.InformixDataProvider
MappingSchema.AddScalarType(_ifxDecimal, GetNullValue(_ifxDecimal), true, DataType.Decimal);
below is the GetNullValue method in that class (lines 130 to 134 of same file), error gets thrown on return getValue.Compile()()
static object GetNullValue(Type type)
{
var getValue = Expression.Lambda<Func<object>>(Expression.Convert(Expression.Field(null, type, "Null"), typeof(object)));
return getValue.Compile()();
}
Additional Info..
In the documentation titled Informix Client Software Development Kit (Version 4.10) in Table 2-1. Best-fit types for retrieving Informix data types it shows that there are three DECIMAL Informix types, each map to three different suggested .NET types
I am afraid you can't use Informix in partial trust environment. When I try to create IfxConnection in partial trust, I get SecurityException - 'That assembly does not allow partially trusted callers.'
Too old to comment, but, I had this error too. Solved it placing getValue.Compile() in place of getValue.Compile()();.
Works fine now.
I am calling BAPI_MATERIAL_SAVEREPLICA for updating the material in SAP through my WCF Web service using Net connector 3.0 in C#.
Before i was getting the validation errors but after populating all validations now i am getting return message
Material successfully checked: no update (test mode)
If Is it because of missing parameters then how can i find which parameter is missing
or do i need to set the testing mode on somewhere in C# code or ABAP .
Thanks
I assume you have set the parameter TESTRUN to 'X'. The system is doing just what you specified: Check the data, but do not update anything. If you want to change the data for real, remove the flag.
I want to know what exactly HRESULT error means? This is occuring when user is trying to download clickonce application from our server. Hence to figure what is the problem behind it I want to know what does this HRESULT number refers to. I tried to use error lookup tool but it says message not found. Is there any way to find this error message? Also it would be great if anyone can tell me how to lookup for error message if HRESULT is given as decimal number?
For reference here is the error log in short:
Property: [AdminUser] = true {boolean}
Property: [ProcessorArchitecture] = Intel {string}
Property: [VersionNT] = 5.1.3 {version}
Running checks for package '.NET Framework 3.5 SP1', phase BuildList
Reading value 'SP' of registry key 'HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5'
Read integer value 1
Setting value '1 {int}' for property 'DotNet35SP'
The following properties have been set for package '.NET Framework 3.5 SP1':
Property: [DotNet35SP] = 1 {int}
Running checks for command 'DotNetFX35SP1\dotNetFx35setup.exe'
Result of running operator 'ValueGreaterThanEqualTo' on property 'DotNet35SP' and value '1': true
Result of checks for command 'DotNetFX35SP1\dotNetFx35setup.exe' is 'Bypass'
'.NET Framework 3.5 SP1' RunCheck result: No Install Needed
Launching Application.
URLDownloadToCacheFile failed with HRESULT '-2146697191'
Error: An error occurred trying to download 'https://SomeWebSite.com/SomeApplication.application'
HRESULT -2146697191 (0x800C0019) means "The Secure Sockets Layer (SSL) certificate is invalid." See INET_E_INVALID_CERTIFICATE.
Also it would be great if anyone can tell me how to lookup for error message if HRESULT is given as decimal number?
The way I do this is to enter the number into the calculator and then switch to hexadecimal display.
In this case it gives FFFFFFFF800C0019. Removing the leading Fs gives an error code of 0x800C0019 which will be searchable.