F# build error: "No compiled representation for provided namespace" - f#

Has anyone run into this error message before? Google found it for me in the source code (https://github.com/fsharp/fsharp/blob/master/src/fsharp/tast.fs), but I haven't the slightest idea what is causing it.
This started happening when I tried to upgrade my library project from .NET 5 to .NET 6, so the real answer to my question may be an explanation of what I did wrong there. All I did was the following:
In the fsproj, changed "TargetFramework" from "net5.0" to "net6.0"
In my paket.dependencies file, changed "framework" from "net5.0" to "net6.0". (I've also tried commenting out the "framework" line.)
Then after running "paket update" and "dotnet build" I get the obscure error. ("error FS0192 : internal error : No compiled representation for provided namespace")
UPDATE: After some laborious code commenting/uncommenting, etc., I believe I've narrowed this down to my code's use of the Fable.RegexProvider assembly. (I use the SafeRegex component.) RegexProvider hasn't been updated in a couple years. I'll alert the folks over there to this issue, and I'll post an update here if/when I learn anything. (In case anybody else runs into this.)

In case anyone else runs into this, here is the solution (which is the solution #CaringDev recommended above, though it only works for Fable 3.7.18 and after):
When I raised this issue on the Fable.RegexProvider github (see thread here: https://github.com/fable-compiler/Fable.RegexProvider/issues/9), the initial thought was to try a .NET 6 build of Fable.RegexProvider. But then Alfonso Garcia-Caro realized that subsequent improvements to Fable may have obviated the need for SafeRegex.
He ultimately needed to tweak something in Fable, but as of version 3.7.18, the Fable transpiler supports the use of FSharp.Text.RegexProvider, such that Fable.RegexProvider is now unnecessary.

Related

Unable to Build mac project in XCode14.0/14.1 with macOS ventura

I have recently updated to macOS 13.0 and for that minimum XCode Version required is 14.x series. But my existing project never getting successfully building. Its getting stuck at some point.
Its not getting failed. Build process screenshot is attached below. Its not pointing to any specific class. Seems like there are lots of classes which are getting compiled successfully at last but still build process is stuck at some point:
Seen similar threads like below on apple pages but nothing seems working. Does anyone got resolution?
Xcode 14 project compile error
XCode 14 compile errors immediately disappear or do not appear at all
Something similar has happened to me in the past on a number of occasions. If the Swift compiler is hanging mid-build, usually the issue is that there is some expression that is too complex for Swift to do the type inference on.
What you need to do is first find the exact statement that is causing the hang. This is how I do it:
First find out which source file is causing the problem. Look at the build log to figure this out (the build log can be located by looking at the reports navigator ⌘9 ). Find the build log and click on it. The build log will appear in an editor window.
One of the compiles will still be in progress and its file is the one you want.
The next thing to do is comment out all the code and recompile. This time the compilation will finish (if you have the right file, or there is only one) but probably with a lot of errors. Then you add the code back in, function by function, until one of them causes the compilation to hang again. If it's not obvious which line of the function is causing the problem, comment it out again and then add the lines back one by one until the compilation breaks again.
Once you have located the line, you need to simplify the type inference on that line. If it's a closure, try adding an explicit declaration for its parameters and return type. If it involves some complex array, try adding a type annotation to its declaration. Also try breaking down complex expressions into multiple simpler expressions.
There's no one size fits all answer to this but usually, once you have located the exact line that is causing the problem, it should be reasonably obvious how to fix it.

Not being able to build F# type provider SDK

I have finally come across something that no one else seemed to have come across (at least from what I can tell). I trying to build an F# type provider using TypeProviders.SDK.
As soon as I build the solution I get the error: "FS0810, Property 'CultureName' cannot be set, \LemonadeProvider\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs" on line 2090 and again at 3162 in the design time project of the solution.
I do not think this is useful but the Test project also fails as it can not find the LemonadeProvider.Runtime.dll. I am assuming this will get created when the Runtime project will build successfully.
PS: As of right now I am just tring to build the provided template, I have not changed the code or added anything to it. Hence I have not attached any code, but please feel free to ask for it.
The corresponding issue is https://github.com/fsprojects/FSharp.TypeProviders.SDK/issues/353
Known workarounds
Change minimum target to net461. Replace all instances of net45 with net461, except for in netfx.props, where you can just delete the lines referencing net45* frameworks (I suspect the removal of those lines isn't strictly speaking necessary).
I did this workaround but am now facing these kinds of errors: (like 2000 of them)
C:\Users\user\source\repos\HelloWorldProvider\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs(34,7): error FS0074: The type referenced through 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard'. [C:\Users\user\source\repos\HelloWorldProvider\src\HelloWorldProvider.DesignTime\HelloWorldProvider.DesignTime.fsproj]
I found out that the issue lied with the ProvidedTypes.fs and ProvidedTypes.fsi files created by the SDK.
The issue was solved for me when I replaced the files with the ones found in 'SDK-dsyme-patch-7' which provided compatibility for different .Net environments which was missing from the original SDK. There might be other differences but this is the one I found and it fixed the problem for me.
The files can be found under '/src/' in the dsyme patch.
The code I am referring to is as follows and has been added twice to the ProvidedTypes.fs:
#if NETSTANDARD
asmName.CultureName <- System.Globalization.CultureInfo.InvariantCulture.Name
#else
asmName.CultureInfo <- System.Globalization.CultureInfo.InvariantCulture
#endif
asmName
I am not aware if there is a new SDK that has solved the problem. But at the time when the question was asked, this is what worked for me.

Unity3d: Error building Player: Append is not supported

I receive this error when appending an already-successful build in XCode. What I don't understand is I'm not changing anything when appending, and this error shows up.
I've never used an 'old version of Xcode' as the error implicitly states.
Does anyone know how to get append working on a consistent basis?
This is a very simple project, and I'm using Playhaven and TapForTap SDK's, if that offers any insight.
Turns out, XCode upgraded itself without telling me. :(
I rolled back to the version I was using and all is well.
With no code snippets or error logs, it's very hard to determine what the source of your problem is. There's no way to know if your error is describing the cause of your problem or a symptom of the problem without more information.
I can only offer some suggestions:
My first thought is that you're using a deprecated method in your code somewhere, possibly "Append", which if that is the case, more than likely has an updated counterpart, but you'll have to check documentation regarding that.
If you've used "Append" previously with no errors, then you should look into what exactly you've changed in your new build, and verify that the methods you're using are supported.
If your errors are vague or unhelpful, you can begin the process of elimination and start commenting out blocks of code until it builds successfully, and narrow down the source of the problem significantly.
However, it would be to your benefit to expand your question with more information.

Xcode ARC conversion tool issue

I'm running the ARC conversion tool for the first time. I've followed the instructions and dealt with all of the issues/erros in my files that the conversion tool finds before it will actually run. I also have several third party libraries that I've told ARC to skip by unchecking them in the Targets to Convert dialog. After running the tool it shows me a report of all the changed files but no files have been changed. Next I save and try to build the project only to find that I have nearly 1000 build errors due to all the calls to retain and release in my project. It's my understanding that the conversion tool is supposed to remove all calls to retain, release, and autorelease but that isn't the case for me.
Has anybody encountered this problem before and if so how did you solve it? Or is it my responsibility to remove all retains & releases from my app? If so I'm not sure what the point of the conversion tool is. Please advise.
Thanks in advance
I am about to try this on my own rather large project, so I may be back with more questions, but I found this that might help:
http://meandmark.com/blog/2011/11/xcode-4-2-convert-to-arc-troubleshooting/
Are you using GIT repositories for your code? It may not be converting due to the snapshot issue described.
This works better in case you allow it to continue building if errors encountered (Preferences - General). However, not all files are changed or converted completely anyway. But a few regulars will do the dirty job.
In case anyone wants to copy and paste;
\[([\[\w\s\]]+) autorelease\]

how to step into system.web.mvc

Does anyone have know how I can step into system.web.mvc? I am getting an error (Cannot create an abstract class) that is buried in the System.Web.Mvc.DefaultModelBinder.CreateModel method, and I can't tell which part of my code is causing the issue.
I was advised that I could download the sourcecode from codeplex, (actually microsoft.com/downloads as I am using 1.0), build in Debug and then step through. I tried, unfortunately the system.web.mvc was installed in GAC, thus causing an ambiguous call, and gacutil would not allow me to uninstall, so tried by hand removing from the registry (HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Global\system.web.mvc). when I ran my program it was still reporting an ambiguous call.
Background
A couple of weeks ago I had a problem where MVC was throwing up a YSOD, but I could not step into the code to find the problem because the issue was I was doing something wrong, that was not being picked up until it was in the framework (in this case, by thrashing around blindly for a day I found it was that I didn't have a default empty constructor on one of the classes within my viewmodel). Now I am getting a different error (Cannot create an abstract class) that is buried in the System.Web.Mvc.DefaultModelBinder.CreateModel method, but I don't know what part of my code is causing the error in the framework.
It's a little involved, but you can do it. Steve Sanderson has step-by-step instructions.
If you have the source code then you can recompile the code using a different assembily name and reference that.

Resources