Python.NET - Name must not be empty - c#

I'm embedding some Python code in C#/.NET and it breaks on this line in Python.NET during import:
public ModuleObject(string name): base() {
if (name==String.Empty)
{
throw new ArgumentException("Name must not be empty!")
}
...
How is it possible that some imported Python module is empty string???
So far this is not reproducible on other machine.
I'm using this branch (locally compiled):
https://github.com/renshawbay/pythonnet

This issue may be caused by relative imports. It appears that this has been patched. For me a fix involved upgrading from pythonnet-2.1.0 to pythonnet-2.2.2
pip install pythonnet --upgrade
References
https://github.com/matthid/pythonnet/commit/28239416e4d30edc0ddd24e77e4181b1c4646c3b
https://github.com/pythonnet/pythonnet/pull/182#issuecomment-222008972

Seaborn 0.5.1 is not correctly installed/uninstalled using Anaconda on Windows 7, 64bit, Python 2.7.
'conda remove seaborn' leaves some seaborn files in site-packages.
EDIT
I just realised why this happened - another process blocked complete uninstallation of seaborn package. this is both for conda and pip. so probably has nothing to do with seaborn or conda.

Related

How to do bundle update in Wix custom bootstrapper application?

I am trying to make an update of bundle which uses custom bootstrapper application, and I don't undestand how to do it. At fist I tried to set in BA UpdateReplace as a LaunchAction, but it didn't work at all. After reading this, i tried to use Install as LaunchAction.
I am trying to increase Version of bundle, UpgradeCode is fixed. Everything in bundle is fixed, only Version is changed.
Log file of new bundle breaks in two parts. First part detects existing packages and related bundle (old version, operation: MajorUpgrade), plans packages and uninstallation for old bundle. Then first log end by this line:
Applying execute package: {9b21f135-98c9-4126-bd07-2b64c9aaa6f5}, action: Uninstall, path: C:\ProgramData\Package Cache\{9b21f135-98c9-4126-bd07-2b64c9aaa6f5}\Bootstrapper.exe, arguments: '"C:\ProgramData\Package Cache\{9b21f135-98c9-4126-bd07-2b64c9aaa6f5}\Bootstrapper.exe" -uninstall -quiet -burn.related.upgrade -burn.ancestors={c641576c-eee6-47c9-bf0c-00c42e8ff5c1} -burn.filehandle.self=984'
The second log file contains this information:
Burn v3.11.1.2318, Windows v10.0 (Build 17763: Service Pack 0), path: C:\ProgramData\Package Cache\{9b21f135-98c9-4126-bd07-2b64c9aaa6f5}\Bootstrapper.exe
Initializing string variable 'Var1' to value 'false'
Initializing string variable 'Var2' to value 'false'
This bundle is being run by a related bundle as type 'Upgrade'.
Command Line: '"-burn.clean.room=C:\ProgramData\Package Cache\{9b21f135-98c9-4126-bd07-2b64c9aaa6f5}\Bootstrapper.exe" -burn.filehandle.attached=616 -burn.filehandle.self=632 -uninstall -quiet -burn.related.upgrade -burn.ancestors={c641576c-eee6-47c9-bf0c-00c42e8ff5c1} -burn.filehandle.self=984 -burn.embedded BurnPipe.{6DD039C2-BF8D-4A6E-B96B-3EA4784A1B37} {7B93845A-F588-4A34-97FD-8243D81D5B26} 7948'
Setting string variable 'WixBundleLog' to value 'C:\Users\BALAKI~1.ELE\AppData\Local\Temp\Производственная_система_20200312142440.log'
Setting string variable 'WixBundleManufacturer' to value 'Kirumata'
Loading managed bootstrapper application.
Creating BA thread to run asynchronously.
And nothing else. No exceptions or errors.
In Programs and Features two bundles with different versions are present. So, as I understand, new version was installed, but old one wasn't removed.
The question is: what is going on here and how to make it work?
Okay, finally I have found the way to manage an update.
First of all, we need to create new Bundle with same UpgradeCode but greater version. And we need to start LaunchAction = Install in Bundle bootstrapp application.
Burn will Install new Bundle and after that Uninstall old version. That is the key: method Run() of the custom BA will be restarted, but second start will be in silent mode. So we need to manage installation both by UI and in silent mode. Like this:
if (this.Command.Display == Display.Full)
{
//UX
view.Show();
}
else
{
//Some kind of silent installation
model.PlanAction(this.Command.Action);
model.ApplyAction();
}

Process terminated. Couldn't find a valid ICU package installed on the system in Asp.Net Core 3 - ubuntu

I am trying to run a Asp.Net Core 3 application in Ubuntu 19.10 thru terminal using dotnet run command but it does not seem to work. I get this error.
Process terminated. Couldn't find a valid ICU package installed on the system.
Set the configuration flag System.Globalization.Invariant to true if you want
to run with no globalization support.
at System.Environment.FailFast(System.String)
at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
at System.Globalization.GlobalizationMode..cctor()
at System.Globalization.CultureData.CreateCultureWithInvariantData()
at System.Globalization.CultureData.get_Invariant()
at System.Globalization.CultureInfo..cctor()
at System.StringComparer..cctor()
at System.StringComparer.get_OrdinalIgnoreCase()
at Microsoft.Extensions.Configuration.ConfigurationProvider..ctor()
at Microsoft.Extensions.Configuration.EnvironmentVariables.EnvironmentVariablesConfigurationSource.Build(Microsoft.Extensions.Configuration.IConfigurationBuilder)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder..ctor(Microsoft.Extensions.Hosting.IHostBuilder)
at Microsoft.Extensions.Hosting.GenericHostWebHostBuilderExtensions.ConfigureWebHost(Microsoft.Extensions.Hosting.IHostBuilder, System.Action'1<Microsoft.AspNetCore.Hosting.IWebHostBuilder>)
at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.ConfigureWebHostDefaults(Microsoft.Extensions.Hosting.IHostBuilder, System.Action'1<Microsoft.AspNetCore.Hosting.IWebHostBuilder>)
at WebApplication.Program.CreateHostBuilder(System.String[])
at WebApplication.Program.Main(System.String[])
I installed the dotnet core sdk using the ubuntu store and after that I also installed Rider IDE.
The weird thing here is that when I run the app using Rider it runs fine, the only issue is using terminal dotnet core commands.
Does anybody know what might be the issue ?
The application is created using Rider. I don't think that this plays a role but just as a side fact.
I know there are also other ways to install dotnet core in ubuntu but since the sdk is available in the ubuntu story I thought it should work out of the box and of course its an easier choice.
Also tried this one but does not seem to work for me. Still the same issue happens after running the commands.
The alternative solution as described in Microsoft documentation is to set environment variable before running your app
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
If you want to run with no globalization support, you need to get "System.Globalization.Invariant": true into your published output AppName.runtimeconfig.json file as shown in the example below:
{
"runtimeOptions": {
"tfm": "netcoreapp3.0",
"configProperties": {
"System.GC.Server": true,
"System.Globalization.Invariant": true
}
}
}
You can add it manually every time you deploy by adding or updating the AppName.runtimeconfig.json file. Better yet, add it once to a runtimeconfig.template.json file like this:
{
"configProperties": {
"System.Globalization.Invariant": true
}
}
Make sure that runtimeconfig.template.json is included in build/publish.
It seem the package libicu63 will provide the ico support for dotnet on Linux, at least on Debian'ish distros.
Update:
And it seems it's "missing" when doing a small installing of Debian (i.e. deselect all applications/system-options in the installation program, except for SSH server)
The trick around it on Ubuntu 20.04 based on this thread https://github.com/dotnet/core/issues/2186#issuecomment-671105420
$export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
Yes. When installing Github action in Debian. It is also required.
As the response from MrCalvin,
sudo apt-get update && sudo apt-get install -qqq libicu63 resolve my issue.
edit your .bashrc file by adding the following line, e.g.:
nano ~/.bashrc
add
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
Ctrl+o, Ctrl+x
restart terminal and run pwsh again
I had this issue while trying to run Umbraco version 9.2.0. Fiddling with System.Globalization.Invariant was not a good solution as it broke globalization in the backoffice. This issue has been solved in v9.4: https://github.com/umbraco/Umbraco-CMS/pull/11961
I didn't want to upgrade my Umbraco version to solve this, so I just copied the change in that commit to my project.
Simply go into the .csproj file of your web project and change the ICU package reference lines to:
<!-- Force windows to use ICU. Otherwise Windows 10 2019H1+ will do it, but older windows 10 and most if not all winodws servers will run NLS -->
<ItemGroup>
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
<RuntimeHostConfigurationOption
Condition="$(RuntimeIdentifier.StartsWith('linux')) Or $(RuntimeIdentifier.StartsWith('win')) Or ('$(RuntimeIdentifier)' == '' And !$([MSBuild]::IsOSPlatform('osx')))"
Include="System.Globalization.AppLocalIcu"
Value="68.2.0.9" />
</ItemGroup>
In my case, I followed the Windows documentation to install SDK dependencies and Runtime, watch out for the corresponding version to each Linux distribution to avoid compatibility issues.
This helped me override the default ICU version to the one that's installed on the machine running arch linux.
export CLR_ICU_VERSION_OVERRIDE=$(pacman -Q icu | awk '{split($0,a," ");print a[2]}' | awk '{split($0,a,"-");print a[1]}')

.NET project Nunit tests are failing during mono build

I'm pretty new to CI (from a brand new set up point at least). I created a project in Rider, using the default version of NUnit that is provided if you select to 'Create new NUnit Project', and I am now trying to set up an automated build for it using travis-CI.
The target .NET framework version of my project and test projects (confirmed in Project properties in Rider) is 4.5.
The version of Nunit I am using is the default version provided with Rider, 3.5.
Here is my .travis.yml build file:
language: csharp
solution: .sln
install:
- nuget restore FindWordsWithConcatenations.sln
- nuget install NUnit.Runners -Version 3.5.0 -OutputDirectory testrunner
script:
- xbuild /p:Configuration=Debug ./FindWordsWithConcatenations.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.5.0/tools/nunit-agent.exe ./TestFindWordsWithConcatenations/bin/Debug/TestFindWordsWithConcatenations.dll
I confirmed on my own machine by running the nuget command that the test runner path should be correct, when I run the nunit-agent (via agent, agent-x86, or agent-console) I get the following error (locally, and on the server):
Unhandled Exception: System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
at System.Guid..ctor(String g)
at NUnit.Agent.NUnitTestAgent.Main(String[] args)
I've also tried running with no configuration mode specified, and with configuration mode of Debug and Release specified.
Unfortunately, the normal tactic of googling/stack overflow hasn't helped, I've seen this error in a few questions, but the cause never seems related to what I'm experiencing.
The last build of the pipeline is available to view here, all the builds thus far have failed, previous builds can be seen here.
Thanks in advance, I would be very grateful if someone had any idea about the cause of this issue, or how I could tackle the test running in a different way.
Solved it.
Updated the script section of the travis config to:
script:
- xbuild /p:Configuration=Debug ./FindWordsWithConcatenations.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe ./TestFindWordsWithConcatenations/bin/Debug/TestFindWordsWithConcatenations.dll
So it's now running the correct console application. Also had to modify the test paths a bit for it to run on the server.

How to resolve dependencies with aspnet vnext on a mac?

In trying to build NuGet3, I'm getting the following error:
~/Projects/NuGet3-dev/src/NuGet.CommandLine/project.json(22,46): error: The dependency fx/Microsoft.Build.Framework >= 14.0.0 could not be resolved.
I have no idea why it wouldn't be resolved, since according to
gacutil -l
I have it:
Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
I looked at everything I could find about this issue, but it's almost entirely Visual Studio and Windows based resolutions, and nothing seems to apply to my situation...
How to make this resolve?
(Assuming you are working on https://github.com/NuGet/NuGet.CommandLine ...)
How to resolve?
Use Windows. This project is not designed to be built on Mono. It is integrated with Windows tooling.
Under POSIX systems (thought, some true operating system):
In short, the dependency is resolved using DNX or dotnet (said M$ .Net Core), and its restore command.
The fx/ stands for framework, just drop the prefix, it should be the same. I sow these kind of notations disappear, when passing to DNX. Just try and install it using the DNX process.
since MSBuild targets and props for DNX are not available, the xbuild script from Mono won't work.
You'll have to use one of
the "deprecated" dnvm.sh script and dnx/dnu commands to restore and then build each sub project.
Note: that yet isn't anymore available at download, and the call to dnvm update-self relaces the script by a "404" ...
The "Microsoft .NET Core Shared Framework Host", "dotnet" (that I don't use)
It should mostly work, if you've got Dnx, try this command line, from the src sub-dir of the NuGet3 source code:
(for d in *; do (cd $d && dnu restore && dnu build); done)2>&1|tee build-all.log
For me, using Debian-8, there are build failures:
NuGet.CommandLine.XPlat
NuGet.Configuration, but it succeeds for the "net451" framework
NuGet.Packaging.Core
NuGet.Packaging
NuGet.Protocol.Core.v3, but it's OK #dnxcore50 (don't ask me why) ...
YANote: If code cannot be transformed anywhere but by M$, this is cannot be source code for me : I cannot not use it as a source. This is a secret code, a private code ... something to throw away, and that probably no one cares.

Compiling mono-2.6 (or later) on Ubuntu?

I am having to building mono from sources, since the Ubuntu package from badgerports is outdated (does not support .Net 4.0)
This is what I have done so far (mostly following instructions here):
cloned mono git repository
switched to branch tagged 2.6 (git checkout mono-2-6)
installed minimal mono on my machine so mono and mcs are available on machine
run ./autogen.sh --prefix=/usr/local
run make
After a few modules compile correctly, I get this error:
make[4]: Entering directory `/home/oompah/work/dev/mono/mono/mini'
CC mini.lo
CC liveness.lo
liveness.c: In function ‘mono_liveness_handle_exception_clauses’:
liveness.c:137: error: ‘MonoCompile’ has no member named ‘header’
make[4]: *** [liveness.lo] Error 1
make[4]: Leaving directory `/home/oompah/work/dev/mono/mono/mini'
make[3]: *** [all] Error 2
I have looked at the offending code, and indeed a header member is being accessed ...
void
mono_liveness_handle_exception_clauses (MonoCompile *cfg)
{
MonoBasicBlock *bb;
GSList *visited = NULL;
MonoMethodHeader *header = cfg->header;
...
}
Has anyone managed to build mono-2.6 (or later) on Ubuntu?
I've used the scripts provided at integratedwebsystems successfully to compile a recent version of mono on my system and run .net 4.0 applications.
an improved version of the script can be found on firegrass' github account
Joe Shields is packaging Mono 2.10 and is patching everything to default to .NET 4.0 for Ubuntu, you might want to poke him on twitter #directhex.

Categories

Resources