Hi I am trying to use DotNetRDf.Query.FullText in .Net core 3.1 to create Lucene indexer but getting below run time exception. Can you please help to resolve this issue?
System.TypeLoadException HResult=0x80131522 Message=Could not load
type 'MaxFieldLength' from assembly 'Lucene.Net, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=85089178b9ac3181'.
Sample Code:
var indexer = new LuceneObjectsIndexer(new RAMDirectory(), new StandardAnalyzer(LuceneVersion), new DefaultIndexSchema());
Package Version Used:
DotNetRDF - 2.1.6
Lucene - 4.8.0-beta00013
Something seems odd about this. Lucene.net 3.x had a MaxFieldLength type that could be passed in an IndexWriter constructor but Lucene.net 4.X has no such type and it's IndexWriter class has no constructor that accepts such a parameter.
See Lucene.net 3.03 ImageWriter class and compare that to Lucene.net 4.8 ImageWriter class
So it feels like the the DotNetRdf library may have been written to depend on a ImageWriter constructor that is only available in a 3.X version of Lucene. If you show a full stack trace that may help shed more light on the situation.
Looking at the dotnetrdf.org site I didn't see where they document what version of Lucene they use, but this error makes it pretty clear the library is designed for Lucene.Net 3.x. I'd recommend trying to use the Lucene.Net 3.03 Nuget packages rather than the 4.8 beta packages and see if that resolves your issues.
Related
I already added the package of Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer, but I'm still getting this error. Is anyone have an idea on how to resolve this issue?Thank you in advance.
Reference: https://www.meziantou.net/versioning-an-asp-net-core-api.htm#integration-with-ope
You haven't said which versions or runtimes you are targeting. I'm going to assume that your project is .NET Core 3.1 or newer and the language is C#. The ApiVersionDesription class is defined in Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.dll. The following are required to resolve this error message:
Reference the Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer NuGet package
Use the corresponding namespace with using Microsoft.AspNetCore.Mvc.ApiExplorer;
You said you've already done #1 so I presume the only issue is #2. If you did not add the reference using tooling, it's worth double-checking that the NuGet package is properly referenced and the containing assembly was also added as a reference.
You also did not mention what your end goal was. 99% of the scenarios that use the API Explorer extensions for API Versioning want to wire up Swashbuckle or some other Open API/Swagger document generator. I would consider reviewing the official API Versioning Swagger Example for ASP.NET Core and cross-reference it with your configuration. It is a working end-to-end solution and should help reveal the step or steps that you're missing.
I am working in the context of a .NET Core application, windows service, and I have a compiler error telling me I've got a type that has moved assemblies. I cannot find said type and I have gone all over looking for it. So far, I have tried using a combination of dnSpy, Dotpeek, and try.dot.net to reference pertinent nuget packages or .dlls' local to my machine to find the System.Security type(s) I'm looking for. Error for the Type is as follows and afaik an assemblage with that version does not exist...anywhere!
The type name 'DirectorySecurity' could not be found in the namespace
'System.Security.AccessControl'. This type has been forwarded to
assembly 'System.IO.FileSystem.AccessControl, Version=4.0.4.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a
reference to that assembly.
Is there a way I can use external tooling to filter or find a type on my machine that the compiler is asking for? I have referenced all manner of dependencies (individually) in Visual Studio then subsequently removed them if that did not satisfy the compiler.
In any event, any help would be appreciated - thanks!
Upon further inspection of the the nuget-package the version of the specific library (and subsequent type) is .NET Standard compliant only with NET Core 2.0 and under; not 3.0 yet...so I have to downgrade the project, find a different workaround, or wait until the System.Security.AccessControl library is compliant with 3.0+.
I've installed VS2015 CTP, created a vNext ConsoleApplication and would like to use NodaTime.
I've added the dependency like so:
"dependencies": {
"NodaTime": "1.3.1"
},
The package gets restored, but when I try to compile the solution, a warning arises:
Type NodaTime.Instant exists in the package: NodaTime 1.3.1, Supported frameworks: .NETFramework 3.5-Client;.NETPortable-net40+sl50+win+wpa81+wp80+MonoAndroid10+MonoTouch10+xamarinios10
The type is then simply not found by the compiler, telling me:
The type or namespace name 'NodaTime' could not be found (are you missing a using directive or an assembly reference?)
Any ideas on how to fix that? Could I also just add it as an dependency of the framework that it exists for?
Most existing packages will not support ASP.NET Core 5 yet; because of the significant differences, they need to be manually updated. If you're wanting to use NodaTime, you'll either need to stick to ASP.NET 5 (not Core) or wait for Jon Skeet to release a Core version.
ASP.NET 5 (not Core) will still let you use all the new functionality, though... except not cross platform.
I need to upgrade an existing rather large application from Symfony 2.0.15 to Symfony 2.4.x (replace with current version).
I'm not quite sure what would be the best strategy to do so. Migration critical features like forms or esi are used, of course :)
Upgrade "step by step" from one major version to another (2.1, 2.2, 2.3, 2.4)
Upgrade directly from 2.0.x to 2.4
Do you have any tips / experience to share ? Would appreciate it :)
Thanks,
Stephan
Each new version comes with an update UPGRADE-2.x.md file containing all intructions to convert your application from the immediately previous version.
I had to do that on my project as well, and I found the step-by-step method more natural and easier to manage. Fact is, there is no file such file as UPGRADE-2.0-to-2.4.md that would help you out for a direct conversion to 2.4.
I shall first recommend to make sure that none of your code uses obsolete functionnalities of Symfony 2.0 (not sure if there are deprecated parts in this version, though), because these can be removed in ulterior versions and will not be included in the UPGRADE file.
If you have done indeep modifications of the core Symfony code, you may find that some undocumented modifications are needed. For instance, there is a custom error handler in my project, extending the Symfony error handler. Well, although it was not documented in the UPGRADE file, the signature of ErrorHandler::handle() was modified and needed to be updated in my custom handler.
Similarly, I had to modify some namespaces because files had been moved in the framework code.
The conversion is still ongoing and I'm currently experiencing a weird error I'm trying to get rid of: The 'request' scope on services registered on custom events generates errors in the logs.
I have a previous project running Ninject 2.0 runtime version 2.0 and now I am using Ninject in a new project and using the new Ninject, ninject web.mvc version 2.2 for runtime version 4.0.
Every single time I get the error no parameterless constructor
Invalid Operation exception
An error occurred when trying to create a controller of type HomeController'. Make sure that the controller has a parameterless public constructor.
What am I missing. All the bindings are registered.
Do I need to now define interfaces for Controllers as well such as HomeController as IHomeController as I have seen in some examples, Or do I get back to using the older version
There is one version that does not show activation exceptions properly but show this exception instead. Most likely the problem is a duplicated binding.
In addition to what Remo Gloor said, you might want to check that MVC is set up to use Ninject correctly. I was doing some things manually on an older version of the MVC plugin and ended up needing to just bite the bullet and make Global extend the NinjectHttpApplication class, which I had previously been avoiding.
The error you're getting is the error you would get if MVC tries using its built-in controller factory to produce controllers. So you may want to create a custom method binding on your controller class and put a breakpoint inside to make sure it's even being invoked.
You may also want to switch to version 2.3. You can pick up the latest builds of Ninject and all its extensions here.
I have seen this issue mentioned couple of times on forums where there is no direct answer, here is the solution to the above problem, i.e., working with latest ninject
Download the latest Ninject from github.
The ninject I got for MVC2 is named as Ninject.Web.Mvc2-2.2.0.0-release-net-4.0 (runtime version 4)
Now during adding reference add Ninject.Web.Mvc.dll(check the version is same as above by right click properties in VS)
Now Add Ninject.dll from the lib folder in same parent folder (check the version as above)
Now Add CommonServiceLocator.NinjectAdapter.dll from the extensions folder in lib parent folder (check the version as above.)
The missing link in all these have been the commonserviceLocator.dll and the correct version should match. This should be tried if you are sure your bindings are correct as mine were and check to see if your project work with older version.
Thanks to everyone, and good luck :)